Mvz.Fwk
3.1.20
dotnet add package Mvz.Fwk --version 3.1.20
NuGet\Install-Package Mvz.Fwk -Version 3.1.20
<PackageReference Include="Mvz.Fwk" Version="3.1.20" />
<PackageVersion Include="Mvz.Fwk" Version="3.1.20" />
<PackageReference Include="Mvz.Fwk" />
paket add Mvz.Fwk --version 3.1.20
#r "nuget: Mvz.Fwk, 3.1.20"
#:package Mvz.Fwk@3.1.20
#addin nuget:?package=Mvz.Fwk&version=3.1.20
#tool nuget:?package=Mvz.Fwk&version=3.1.20
🚀 Mvz.Fwk - Framework Empresarial Movizen
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)
- ⚠️ Exceptions - Manejo centralizado de errores
- 🌍 Localization - Internacionalización
📖 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:
- Crear un branch desde
develop
- Implementar cambios con sus respectivos tests
- Crear Pull Request con descripción detallada
- Code review por el equipo técnico
- 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 | Versions 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. |
-
net8.0
- AspNetCoreRateLimit (>= 5.0.0)
- Autofac.Extensions.DependencyInjection (>= 9.0.0)
- AutoMapper (>= 13.0.1)
- CsvHelper (>= 32.0.1)
- EPPlus (>= 7.1.2)
- ExcelDataReader (>= 3.6.0)
- FluentValidation (>= 11.9.1)
- FluentValidation.AspNetCore (>= 11.3.0)
- LazyCache.AspNetCore (>= 2.4.0)
- MediatR (>= 12.2.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.4)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 8.0.4)
- Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (>= 8.0.17)
- Microsoft.EntityFrameworkCore (>= 8.0.7)
- Microsoft.EntityFrameworkCore.InMemory (>= 8.0.3)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.7)
- Microsoft.OpenApi (>= 1.6.14)
- MySql.Data (>= 8.4.0)
- MySql.EntityFrameworkCore (>= 8.0.2)
- NPOI (>= 2.7.0)
- RazorEngine.NetCore (>= 3.1.0)
- Serilog.AspNetCore (>= 8.0.1)
- Serilog.Settings.Configuration (>= 8.0.0)
- Serilog.Sinks.MSSqlServer (>= 6.6.0)
- Swashbuckle.AspNetCore (>= 6.6.1)
- Swashbuckle.AspNetCore.Filters (>= 7.0.12)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.6.1)
- System.IdentityModel.Tokens.Jwt (>= 7.5.1)
- System.Linq.Dynamic.Core (>= 1.6.0.2)
- Wacton.Unicolour (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.