ModulusKit.Generators
3.0.0
See the version list below for details.
dotnet add package ModulusKit.Generators --version 3.0.0
NuGet\Install-Package ModulusKit.Generators -Version 3.0.0
<PackageReference Include="ModulusKit.Generators" Version="3.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="ModulusKit.Generators" Version="3.0.0" />
<PackageReference Include="ModulusKit.Generators"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add ModulusKit.Generators --version 3.0.0
#r "nuget: ModulusKit.Generators, 3.0.0"
#:package ModulusKit.Generators@3.0.0
#addin nuget:?package=ModulusKit.Generators&version=3.0.0
#tool nuget:?package=ModulusKit.Generators&version=3.0.0
ModulusKit.Generators
Roslyn incremental source generators for Modulus -- strongly typed IDs, handler registration, and module auto-discovery.
Installation
dotnet add package ModulusKit.Generators
Or as an analyzer reference in your .csproj:
<PackageReference Include="ModulusKit.Generators"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
Note: This is a development-dependency (analyzer) package -- it does not flow transitively through other
ModulusKit.*packages or through project references. Add the reference above to every project that defines handlers, validators, or[StronglyTypedId]types (and to the host, for module discovery). Solutions scaffolded by themodulusCLI have this wired up already.
Strongly Typed IDs
Generate type-safe entity identifiers with EF Core, JSON, and model binding support:
using Modulus.Mediator.Abstractions;
[StronglyTypedId]
public readonly partial record struct OrderId;
[StronglyTypedId(typeof(int))]
public readonly partial record struct SequenceNumber;
The generator produces: Value property, constructor, New() factory, Empty, plus ValueConverter (EF Core), JsonConverter (System.Text.Json), and TypeConverter (model binding).
Supported backing types: Guid (default), int, long.
Handler Registration
Auto-register all handlers and validators at compile time:
// Source-generated extension method
services.AddModulusHandlers();
Discovers: ICommandHandler<>, IQueryHandler<>, IStreamQueryHandler<>, IDomainEventHandler<>, IIntegrationEventHandler<>, and AbstractValidator<>.
Module Auto-Discovery
Auto-discover all IModuleRegistration implementations from referenced assemblies:
// Source-generated extension methods
builder.Services.AddAllModules(builder.Configuration);
app.MapAllModuleEndpoints();
Control initialization order with [ModuleOrder(n)].
Diagnostics
| ID | Severity | Description |
|---|---|---|
| MODGEN001 | Error | [StronglyTypedId] target must be partial |
| MODGEN002 | Error | [StronglyTypedId] target must be a record struct |
| MODGEN003 | Info | Open generic handler skipped for registration |
| MODGEN004 | Warning | IModuleRegistration missing required static methods |
| MODGEN005 | Error | [StronglyTypedId] backing type is unsupported (only Guid, int, long) |
| MODGEN006 | Error | [StronglyTypedId] target must be a top-level type |
Learn More
See the Modulus documentation for full generator reference.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
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 |
|---|---|---|
| 4.0.0 | 103 | 7/26/2026 |
| 3.1.0 | 295 | 7/26/2026 |
| 3.0.0 | 231 | 7/26/2026 |
| 2.1.0 | 101 | 7/4/2026 |
| 2.0.0 | 106 | 7/3/2026 |
| 1.2.5 | 130 | 3/15/2026 |
| 1.2.4 | 116 | 3/15/2026 |
| 1.2.3 | 115 | 3/14/2026 |
| 1.2.2 | 114 | 3/14/2026 |
| 1.2.1 | 114 | 3/14/2026 |
| 1.2.0 | 123 | 3/14/2026 |
| 1.1.1 | 110 | 3/8/2026 |
| 1.1.0 | 111 | 3/5/2026 |
| 1.0.1 | 114 | 3/5/2026 |