Strongly-typed DDD, Clean Architecture, CQRS and functional Result building blocks for .NET 8
egl-util-csharp is a library written in C# 12 / .NET 8, built and governed to an enterprise quality bar: a full CI matrix (Linux/Windows/macOS), static analysis with nullable-as-errors, real-Redis integration tests, documented design decisions (ADRs), and SemVer releases.
egl-util-csharp is a NuGet utility library of strongly-typed, immutable, extensible architectural building blocks for .NET applications that adopt Domain-Driven Design, Clean Architecture, and CQRS. It removes the boilerplate of re-implementing entities, value objects, aggregates, the Result error-handling pattern, repositories / specifications / unit-of-work, an in-memory event broker, password hashing, validation, and two-level caching, so teams focus on domain logic with compile-time safety instead of re-deriving the same scaffolding per project.
The frozen specification is in
docs/specs/01_spec_util.md.
The core ships as a single NuGet package bundling the domain, application, and infrastructure layers — with no MediatR or FluentValidation dependency:
dotnet add package It.D4np.UtilThe MediatR/FluentValidation integration — the DomainEventNotification adapter and the FluentValidation
ValidationPipelineBehavior — is an opt-in package. Add it only if you use them:
dotnet add package It.D4np.Util.MediatRFunctional, exception-free error handling with Result (illustrative):
using It.D4np.Util.Domain;
public Result<User> Register(string email) =>
string.IsNullOrWhiteSpace(email)
? Result.Failure<User>(new Error("User.Email.Required", "Email is required."))
: Result.Success(new User(Guid.NewGuid(), email));One-call dependency-injection wiring — registers the building blocks and assembly-scans for your event handlers:
using It.D4np.Util.Infrastructure;
services.AddD4npUtil(typeof(Program).Assembly);With the opt-in It.D4np.Util.MediatR package, also wire its FluentValidation pipeline behavior and
validator scan:
using It.D4np.Util.Infrastructure;
using It.D4np.Util.MediatR;
services.AddD4npUtil(typeof(Program).Assembly) // core services + event-handler scan
.AddD4npUtilMediatR(typeof(Program).Assembly); // + MediatR validation behavior & validator scandotnet build -c Release
dotnet test -c Release- Toolchain: dotnet SDK (MSBuild), Directory.Build.props, xUnit (+ FsCheck for property tests), dotnet format / CSharpier, Roslyn analyzers + .editorconfig (warnings as errors).
- Supported platforms: Linux x64, Windows x64, macOS arm64 (.NET 8).
- Consumers import the public surface via the layer namespaces
It.D4np.Util.Domain,It.D4np.Util.Application, andIt.D4np.Util.Infrastructure.
See docs/development/local-build.md for the full local setup.
| Document | Purpose |
|---|---|
AGENTS.md |
How AI agents (and humans) work in this repo — the contract. |
docs/ROADMAP.md |
The numbered plan and what is done. |
docs/adr/ |
Why it is built the way it is (Architecture Decision Records). |
docs/patterns/ |
Design patterns adopted, rejected, or considered. |
docs/workflow/ |
Git, documentation, release, and maintenance conventions. |
CONTRIBUTING.md |
How to propose changes and the contribution workflow. |
CHANGELOG.md |
User-visible changes per release. |
SECURITY.md |
How to report a vulnerability. |
CODE_OF_CONDUCT.md |
Community standards for participation. |
| # | Title | Status |
|---|---|---|
| 1 | Project bootstrap & CI | ✅ done |
| 2 | DDD core building blocks | ✅ done |
| 3 | Functional Result error model | ✅ done |
| 4 | Persistence patterns | ✅ done |
| 5 | In-memory eventing & messaging | ✅ done |
| 6 | Security & validation | ✅ done |
| 7 | Caching & optimization | ✅ done |
| 8 | Utilities, DI, and 1.0 hardening | ✅ done |
MIT © 2026 Daniel Polo. See LICENSE.