Introduction
Pragmatic Design is a .NET meta-framework powered by Source Generators. It turns your architecture declarations into fully wired, production-ready code — all at compile time, with zero reflection and zero runtime overhead.
The Problem
Section titled “The Problem”Building .NET applications today means writing the same boilerplate over and over: repository implementations, endpoint registrations, validation wiring, DI setup, entity configurations. This repetitive code is error-prone, hard to maintain, and slows you down.
The Solution
Section titled “The Solution”With Pragmatic Design, you declare your intent using attributes and base classes. A unified Source Generator detects your architecture and forges the rest:
[DomainAction]public partial class PlaceOrder : IDomainAction<OrderResult>{ public required string CustomerId { get; init; } public required List<OrderItem> Items { get; init; }}
// The Source Generator produces:// ✓ Invoker with full DI pipeline// ✓ Validation, authorization, logging// ✓ HTTP endpoint registration// ✓ Zero reflection — all compile-timeKey Principles
Section titled “Key Principles”- Zero Reflection — Everything is resolved at compile time. No
typeof(T).GetProperties(), no hidden allocations. - Modular by Design — 20+ composable modules. Add a NuGet, the generator sees it, code is forged. Remove it, code disappears.
- Pragmatic, Not Dogmatic — Sensible defaults that work. Override anything. It’s your code, forged your way.
- AOT Ready — Zero reflection means native AOT compilation works out of the box.
Architecture
Section titled “Architecture”Pragmatic Design is organized in three layers:
| Layer | Modules | Purpose |
|---|---|---|
| Foundation | Result, Ensure, DI, Abstractions | Core building blocks |
| Capabilities | Validation, Mapping, Caching, Specification, i18n | Feature modules |
| Integration | Actions, Endpoints, Persistence, Composition | Full-stack wiring |
Each module is independently useful — but they compose beautifully together.
Next Steps
Section titled “Next Steps”- Installation — Get up and running in minutes
- Architecture — Understand the module system
- Endpoints — Build your first endpoint