DD

Domain-Driven Design

Used in 293 csharp projects (avg ★54)

C#
Architecture
Used by 293 projects
webapp
api
library

Details

Language / Topic
csharpC#
Category
Architecture

Rules

balanced
- Organize by bounded contexts with separate Domain, Application, and Infrastructure for each.
- Use rich domain entities with encapsulated behavior and private setters.
- Use Value Objects (`record` types) for domain concepts like Money, Email, Address — they enforce invariants and prevent primitive obsession.
- Use value objects (records) for domain concepts: `Money`, `Email`, `Address`.
- Define aggregate roots with `IAggregate` interface. Only repositories for aggregate roots.
- Use domain events (`INotification` in MediatR) for cross-aggregate communication.
- Enforce invariants in entity constructors and methods — never allow invalid state.