Skip to content

Latest commit

 

History

History

README.md

SimpleModule.Generator

NuGet

Roslyn source generator that auto-discovers modules, endpoints, and DTOs at compile time.

Installation

dotnet add package SimpleModule.Generator

Quick Start

The generator runs automatically at build time. Reference it in your host project and call the generated extension methods:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddModules(); // Generated method

var app = builder.Build();
app.MapModuleEndpoints(); // Generated method

What It Generates

  • AddModules() -- registers all discovered module services
  • MapModuleEndpoints() -- maps all IEndpoint implementations
  • CollectModuleMenuItems() -- gathers menu registrations from all modules
  • JSON serializer contexts for all [Dto] types
  • TypeScript interface definitions embedded as resources
  • View page registry mapping view endpoints to React components

Key Features

  • Compile-time module discovery with zero runtime reflection
  • Incremental generation via Roslyn IIncrementalGenerator
  • Targets netstandard2.0 for broad analyzer compatibility

Links