Installation
Prerequisites
Section titled “Prerequisites”- .NET 10 SDK or later
- An IDE with C# support (VS 2022, Rider, VS Code)
Quick Setup
Section titled “Quick Setup”1. Add the NuGet packages
Section titled “1. Add the NuGet packages”Start with the modules you need:
# Core (always needed)dotnet add package Pragmatic.Resultdotnet add package Pragmatic.Ensure
# Pick what you needdotnet add package Pragmatic.Endpointsdotnet add package Pragmatic.Actionsdotnet add package Pragmatic.Persistence.EFCoredotnet add package Pragmatic.Validationdotnet add package Pragmatic.Mapping2. Add the Source Generator
Section titled “2. Add the Source Generator”<ProjectReference Include="path/to/Pragmatic.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />Or via NuGet (when published):
dotnet add package Pragmatic.SourceGenerator3. Build and go
Section titled “3. Build and go”dotnet buildThe Source Generator automatically detects which Pragmatic modules are referenced and generates the appropriate code. No configuration needed.
What Gets Generated
Section titled “What Gets Generated”The generator scans your referenced assemblies and produces code based on what it finds:
| If you reference… | The generator produces… |
|---|---|
Pragmatic.Endpoints | Endpoint registration, request binding |
Pragmatic.Actions | Action invokers, DI wiring |
Pragmatic.Persistence.EFCore | Repositories, entity configs, query filters |
Pragmatic.Validation | Validator registration |
Pragmatic.Mapping | Mapping extension methods |
Pragmatic.Composition | Startup step orchestration |
Verify Installation
Section titled “Verify Installation”After building, check the obj/ folder for generated files:
obj/Debug/net10.0/generated/└── Pragmatic.SourceGenerator/ ├── PlaceOrder.Invoker.g.cs ├── GetProductEndpoint.Handler.g.cs └── ...Next Steps
Section titled “Next Steps”- Architecture — How modules compose together
- Endpoints — Build your first endpoint