Lumen.Modularity
1.0.0
dotnet add package Lumen.Modularity --version 1.0.0
NuGet\Install-Package Lumen.Modularity -Version 1.0.0
<PackageReference Include="Lumen.Modularity" Version="1.0.0" />
<PackageVersion Include="Lumen.Modularity" Version="1.0.0" />
<PackageReference Include="Lumen.Modularity" />
paket add Lumen.Modularity --version 1.0.0
#r "nuget: Lumen.Modularity, 1.0.0"
#:package Lumen.Modularity@1.0.0
#addin nuget:?package=Lumen.Modularity&version=1.0.0
#tool nuget:?package=Lumen.Modularity&version=1.0.0
Lumen.Modularity
Building block reutilizável para construir monolitos modulares em ASP.NET Core. Marque uma classe com [Module] implementando IModule e o host descobre o módulo por assembly scanning, registra seus serviços, mapeia seus endpoints e liga o event bus — sem fiação manual.
Instalação
dotnet add package Lumen.Modularity
Requer um projeto ASP.NET Core (Web SDK) — a lib usa o shared framework
Microsoft.AspNetCore.Apppara mapear endpoints.
Conceito
[Module]/IModule— cada módulo é uma vertical autocontida.IModuleexpõeRegisterServices(IServiceCollection, IConfiguration)eMapEndpoints(IEndpointRouteBuilder).AddModules/MapModules— auto-discovery por assembly scanning: o host registra serviços e mapeia endpoints de todos os módulos sem registro manual.IEventBus/InProcessEventBus/AddEventBus— barramento in-process para integration events entre módulos.PublishAsyncabre um DI scope por publicação (handlersScoped, comoDbContext, funcionam) e resolve todos osIIntegrationEventHandler<TEvent>.IIntegrationEvent/IntegrationEvent— base para eventos de integração cross-módulo (carregaEventIdeOccurredOn).
Uso
Defina um módulo:
[Module]
public sealed class BillingModule : IModule
{
public static Assembly Assembly => typeof(BillingModule).Assembly;
public void RegisterServices(IServiceCollection services, IConfiguration configuration)
{
// DI do módulo
}
public void MapEndpoints(IEndpointRouteBuilder endpoints)
{
// rotas do módulo
}
}
Componha no host — as únicas chamadas necessárias:
builder.Services.AddModules(BillingModule.Assembly, OrdersModule.Assembly);
builder.Services.AddEventBus(BillingModule.Assembly, OrdersModule.Assembly);
var app = builder.Build();
app.MapModules();
Comunicação entre módulos via integration event:
public sealed record OrderPlaced(Guid OrderId) : IntegrationEvent;
// publica (ex.: no módulo Orders)
await _eventBus.PublishAsync(new OrderPlaced(orderId), ct);
// consome (ex.: no módulo Billing) — handler descoberto pelo AddEventBus
internal sealed class OrderPlacedHandler : IIntegrationEventHandler<OrderPlaced>
{
public Task HandleAsync(OrderPlaced e, CancellationToken ct = default) { /* ... */ }
}
Princípio
0 dependências de internals entre módulos. Cada módulo expõe um assembly de Contratos (interfaces + integration events); outros módulos referenciam só os Contratos, nunca os internals. Lumen.Modularity fornece a base para esse padrão.
Licença
| 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Lumen.Modularity:
| Package | Downloads |
|---|---|
|
Lumen.Authorization.Contracts
Public interfaces and exported events for Lumen.Authorization. Reference this package when you only need IUserPermissionService or IUserIdAccessor without taking a dependency on the full authorization core. |
|
|
Lumen.Authorization
Core of Lumen.Authorization: domain entities (Permission, Profile, UserProfile), CQRS command/query handlers, EF Core persistence supporting SQL Server and PostgreSQL, and DI registration via AddLumenAuthorization(). |
|
|
Lumen.Identity
Core of Lumen.Identity: user domain (User, tokens, lockout), JWT/HS256 with refresh-token rotation, BCrypt, email confirmation, password reset, and integration bridges (IAuthorizationUserSource, IUserDirectory) for Lumen.Authorization. DI entry-point: AddLumenIdentity(). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 853 | 7/5/2026 |