Lumen.Modularity 1.0.0

dotnet add package Lumen.Modularity --version 1.0.0
                    
NuGet\Install-Package Lumen.Modularity -Version 1.0.0
                    
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="Lumen.Modularity" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lumen.Modularity" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lumen.Modularity" />
                    
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 Lumen.Modularity --version 1.0.0
                    
#r "nuget: Lumen.Modularity, 1.0.0"
                    
#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 Lumen.Modularity@1.0.0
                    
#: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=Lumen.Modularity&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lumen.Modularity&version=1.0.0
                    
Install as a Cake Tool

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.App para mapear endpoints.

Conceito

  • [Module] / IModule — cada módulo é uma vertical autocontida. IModule expõe RegisterServices(IServiceCollection, IConfiguration) e MapEndpoints(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. PublishAsync abre um DI scope por publicação (handlers Scoped, como DbContext, funcionam) e resolve todos os IIntegrationEventHandler<TEvent>.
  • IIntegrationEvent / IntegrationEvent — base para eventos de integração cross-módulo (carrega EventId e OccurredOn).

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

MIT

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 (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