Mvz.Fwk 3.1.20

dotnet add package Mvz.Fwk --version 3.1.20
                    
NuGet\Install-Package Mvz.Fwk -Version 3.1.20
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mvz.Fwk" Version="3.1.20" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mvz.Fwk" Version="3.1.20" />
                    
Directory.Packages.props
<PackageReference Include="Mvz.Fwk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mvz.Fwk --version 3.1.20
                    
#r "nuget: Mvz.Fwk, 3.1.20"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mvz.Fwk@3.1.20
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mvz.Fwk&version=3.1.20
                    
Install as a Cake Addin
#tool nuget:?package=Mvz.Fwk&version=3.1.20
                    
Install as a Cake Tool

🚀 Mvz.Fwk - Framework Empresarial Movizen

NuGet Version .NET 8.0 License Build Status Coverage

Framework empresarial desarrollado por Movizen S.A.S para estandarizar y acelerar el desarrollo de aplicaciones .NET con arquitectura Domain-Driven Design (DDD) y APIs REST de clase empresarial.

🎯 Descripción

Mvz.Fwk es una librería integral que proporciona una base sólida, consistente y altamente productiva para todos los desarrollos .NET en Movizen. Incluye componentes pre-configurados para autenticación, autorización, validación, logging, manejo de errores, documentación API y mucho más.

⚡ Quick Start

# Crear nuevo proyecto
dotnet new webapi -n MiProyecto.WebAPI
cd MiProyecto.WebAPI

# Agregar Mvz.Fwk
dotnet add package Mvz.Fwk

# Configurar en Program.cs
builder.Services.AddMvzFramework(builder.Configuration);
app.UseMvzFramework();

🎓 Tutorial completo de 15 minutos

📁 Estructura del Proyecto

mvz-fwk/
├── 📂 src/                    # Código fuente
│   └── 📦 Mvz.Fwk/           # Framework principal
├── 📂 tests/                  # Suite de pruebas
│   ├── 🧪 Mvz.Fwk.Tests/     # Tests unitarios
│   └── 🔗 Integration/        # Tests de integración
├── 📂 samples/                # Proyectos de ejemplo
│   ├── 🌐 BasicWebApi/        # API básica CRUD
│   ├── 🏗️ AdvancedCrud/      # CRUD empresarial
│   └── 📚 tutorials/          # Tutoriales paso a paso
├── 📂 docs/                   # Documentación técnica
│   ├── 🏗️ architecture/       # Diseño y patrones
│   ├── 📖 api/               # API Reference
│   └── 🚀 guides/            # Guías de implementación
├── 📂 guidelines/             # Estándares de código
└── 📂 tools/                  # Herramientas de desarrollo

🏗️ Arquitectura Soportada

El framework está diseñado para la siguiente estructura de capas DDD:

� Cliente.Proyecto.WebAPI        # 🎯 Punto de entrada y hosting
� Cliente.Proyecto.Controllers   # 🎮 Controladores Web API y endpoints
� Cliente.Proyecto.Application   # 🔧 Servicios de aplicación y DTOs
� Cliente.Proyecto.Domain        # 🏛️ Entidades y reglas de negocio
� Cliente.Proyecto.Infrastructure # 🗄️ Repositorios y acceso a datos
� Cliente.Proyecto.Migrations    # 🔄 Migraciones de BD (SQL/MySQL)

📖 Ver documentación completa - Índice completo de toda la documentación

� Características Principales

  • AutoFac: Inyección de dependencias con registro modular automático
  • AutoMapper: Mapeo automático entre entidades y DTOs
  • MediatR: Patrón mediator para comandos y consultas
  • Entity Framework Core: ORM con soporte para SQL Server y MySQL
  • Serilog: Logging estructurado con múltiples sinks

🎯 Patrones de Desarrollo

  • CRUD Genérico: Controladores y servicios base para operaciones CRUD
  • Repository Pattern: Implementación base para repositorios
  • Specification Pattern: Para consultas complejas y reutilizables
  • Validation: Integración con FluentValidation
  • Multi-tenancy: Soporte nativo para aplicaciones multi-tenant

🔐 Seguridad y Autenticación

  • JWT Bearer: Autenticación con tokens JWT
  • Rate Limiting: Control de velocidad de requests
  • CORS: Configuración flexible de políticas CORS
  • Encryption: Servicios de cifrado y descifrado

📊 Utilidades y Herramientas

  • Excel Export/Import: Manejo de archivos Excel con EPPlus y NPOI
  • Email Service: Envío de correos electrónicos
  • File Management: Gestión de archivos y tipos MIME
  • Extension Methods: Métodos de extensión para tipos comunes
  • Dynamic LINQ: Consultas dinámicas con expresiones

📚 Documentación y Testing

  • Swagger/OpenAPI: Documentación automática de APIs
  • API Versioning: Versionado de APIs
  • Custom Exception Handling: Manejo centralizado de errores
  • Data Generation: Generación de datos dummy para testing

📦 Instalación

Desde NuGet Package Manager

Install-Package Mvz.Fwk

Desde .NET CLI

dotnet add package Mvz.Fwk

Desde PackageReference

<PackageReference Include="Mvz.Fwk" Version="3.1.6" />

⚙️ Configuración Básica

1. Configuración en Program.cs (.NET 8)

using Mvz.Fwk.AutoFac;
using Mvz.Fwk.Controllers;
using Mvz.Fwk.Swagger;

var builder = WebApplication.CreateBuilder(args);

// Registrar servicios del framework
builder.Services.AddMvzFramework(builder.Configuration);

// AutoFac como contenedor DI
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
{
    containerBuilder.RegisterModule<AutofacBaseModule>();
    // Registrar módulos específicos del proyecto
});

var app = builder.Build();

// Configurar pipeline
app.UseMvzFramework();

app.Run();

2. Configuración en appsettings.json

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=YourDb;Trusted_Connection=true;"
  },
  "JWT": {
    "SecretKey": "your-secret-key-here",
    "Issuer": "your-app",
    "Audience": "your-audience",
    "ExpirationMinutes": 60
  },
  "Swagger": {
    "Title": "Your API",
    "Version": "v1",
    "Description": "API documentation"
  },
  "Serilog": {
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "Console"
      },
      {
        "Name": "MSSqlServer",
        "Args": {
          "connectionString": "DefaultConnection",
          "tableName": "Logs",
          "autoCreateSqlTable": true
        }
      }
    ]
  }
}

🏛️ Uso del Framework

Entidades de Dominio

using Mvz.Fwk.Domain;

public class Product : Entity, ITenantEntity
{
    public string Name { get; set; }
    public decimal Price { get; set; }
    public string Description { get; set; }
    public long TenantId { get; set; }
}

DTOs de Aplicación

using Mvz.Fwk.Application;

public class ProductDto : IdentifiableDto
{
    public string Name { get; set; }
    public decimal Price { get; set; }
    public string Description { get; set; }
}

public class CreateProductInput : Dto
{
    public string Name { get; set; }
    public decimal Price { get; set; }
    public string Description { get; set; }
}

Repositorios

using Mvz.Fwk.Infrastructure.Data;

public interface IProductRepository : IRepository<Product>
{
    Task<IEnumerable<Product>> GetByCategory(string category);
}

public class ProductRepository : Repository<Product>, IProductRepository
{
    public ProductRepository(DbContext context) : base(context) { }
    
    public async Task<IEnumerable<Product>> GetByCategory(string category)
    {
        return await GetManyAsync(p => p.Category == category);
    }
}

Servicios de Aplicación

using Mvz.Fwk.Application;

public class ProductAppService : CrudAppService<Product, ProductDto, ProductSummaryDto, 
                                               GetProductsQuery, CreateProductInput, 
                                               UpdateProductInput, IProductRepository>
{
    public ProductAppService(IProductRepository repository, IMapper mapper, 
                           ISessionService sessionService) 
        : base(repository, mapper, sessionService)
    {
    }
    
    // Métodos personalizados adicionales
}

Controladores

using Mvz.Fwk.Controllers;

[ApiController]
[Route("api/[controller]")]
public class ProductsController : CrudController<ProductDto, ProductSummaryDto, 
                                                GetProductsQuery, CreateProductInput, 
                                                UpdateProductInput, ProductAppService>
{
    public ProductsController(ProductAppService service, IGenericValidatorService validatorService) 
        : base(service, validatorService)
    {
    }
    
    // Endpoints personalizados adicionales
}

🔧 Componentes Avanzados

Multi-tenancy

// Las entidades que implementen ITenantEntity automáticamente 
// serán filtradas por TenantId
public class Customer : Entity, ITenantEntity
{
    public string Name { get; set; }
    public long TenantId { get; set; } // Filtrado automático
}

Validaciones con FluentValidation

public class CreateProductValidator : AbstractValidator<CreateProductInput>
{
    public CreateProductValidator()
    {
        RuleFor(x => x.Name).NotEmpty().MaximumLength(100);
        RuleFor(x => x.Price).GreaterThan(0);
    }
}

Especificaciones de Dominio

public class ActiveProductsSpecification : Specification<Product>
{
    public override Expression<Func<Product, bool>> ToExpression()
    {
        return product => product.IsActive && product.Stock > 0;
    }
}

📊 Funcionalidades Adicionales

Exportación a Excel

public async Task<FileResult> ExportToExcel()
{
    var products = await _productService.GetAllAsync();
    var excelFile = ExcelExport.CreateExcelFile(products, "Products");
    return File(excelFile, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
                "products.xlsx");
}

Logging Estructurado

public class ProductService
{
    private readonly ILogger<ProductService> _logger;
    
    public async Task CreateProduct(CreateProductInput input)
    {
        _logger.LogInformation("Creating product {ProductName} for tenant {TenantId}", 
                              input.Name, _sessionService.TenantId);
        
        // Lógica de creación
        
        _logger.LogInformation("Product {ProductId} created successfully", product.Id);
    }
}

🐛 Manejo de Errores

El framework incluye manejo centralizado de errores con diferentes tipos:

// Errores de negocio
throw new BusinessException("Product not found");

// Errores de infraestructura  
throw new InfrastructureException("Database connection failed");

// Errores de validación (automáticos con FluentValidation)

🧪 Testing

Configuración para Testing

public class ProductServiceTests
{
    private readonly IServiceProvider _serviceProvider;
    
    public ProductServiceTests()
    {
        var services = new ServiceCollection();
        services.AddDbContext<TestDbContext>(options => 
            options.UseInMemoryDatabase("TestDb"));
        services.AddMvzFrameworkForTesting();
        
        _serviceProvider = services.BuildServiceProvider();
    }
}

📈 Versionado de APIs

[ApiVersion("1.0")]
[ApiVersion("2.0")]
[Route("api/v{version:apiVersion}/[controller]")]
public class ProductsController : CrudController<...>
{
    [HttpGet]
    [MapToApiVersion("1.0")]
    public async Task<ActionResult> GetV1() { }
    
    [HttpGet]
    [MapToApiVersion("2.0")]  
    public async Task<ActionResult> GetV2() { }
}

🔗 Dependencias Principales

  • .NET 8.0: Framework base
  • AutoFac 9.0: Inyección de dependencias
  • AutoMapper 13.0: Mapeo objeto-objeto
  • Entity Framework Core 8.0: ORM
  • FluentValidation 11.9: Validación de modelos
  • MediatR 12.2: Patrón mediator
  • Serilog 8.0: Logging estructurado
  • Swashbuckle 6.6: Documentación OpenAPI/Swagger
  • JWT Bearer: Autenticación
  • EPPlus 7.1: Manejo de Excel

🤝 Contribuciones

Este framework es de uso interno en Movizen S.A.S. Para contribuciones, mejoras o reportes de bugs:

  1. Crear un branch desde develop
  2. Implementar cambios con sus respectivos tests
  3. Crear Pull Request con descripción detallada
  4. Code review por el equipo técnico
  5. Merge a develop y posterior release

Estándares de Código

  • Seguir las convenciones de C# y .NET
  • Documentar APIs públicas con XML comments
  • Incluir tests unitarios para nueva funcionalidad
  • Mantener cobertura de tests > 80%

📞 Soporte y Contacto

Movizen S.A.S

  • Repositorio: Contactar al administrador del repositorio
  • Equipo Técnico: Contactar al líder técnico del proyecto
  • Documentación: Consultar la wiki interna del proyecto

📋 Changelog

v3.1.6 (Actual)

  • Actualización a .NET 8.0
  • Mejoras en el sistema de multi-tenancy
  • Optimizaciones de performance en consultas
  • Nuevos métodos de extensión para Entity Framework

Versiones Anteriores

Ver el historial completo de cambios en el repositorio.


© 2025 Movizen S.A.S - Framework empresarial para desarrollo .NET

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.20 135 8/19/2025
3.1.17 226 8/5/2025
3.1.15 200 8/4/2025
3.0.21 182 4/11/2025