Domain-Driven Design (DDD) in .NET - Basics & Patterns

Implement DDD patterns like Aggregates, Entities, and Value Objects in .NET.

1|8|Updated Nov 16, 2023
One-click install
npx skills add https://github.com/zlzforever/WildGoose --skill domain-driven-design-ddd-in-net-basics-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Domain-Driven Design (DDD) in .NET - Basics & Patterns
Source: https://github.com/zlzforever/WildGoose/tree/main/.claude/ddd-dotnet
Command: npx skills add https://github.com/zlzforever/WildGoose --skill domain-driven-design-ddd-in-net-basics-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a structured and practical approach to implementing Domain-Driven Design (DDD) principles in .NET applications, leading to more maintainable, testable, and robust software.

Core Features & Use Cases

  • Core DDD Building Blocks: Learn to implement Aggregates, Entities, and Value Objects correctly.
  • CQRS & Hexagonal Architecture: Understand how to separate concerns and optimize read/write operations.
  • Testability & Time Control: Implement deterministic time handling and write testable domain logic.
  • Use Case: When building a new e-commerce platform, use this Skill to design the Order aggregate, ensuring all business rules and state transitions are correctly encapsulated and testable.

Quick Start

Use the ddd-dotnet skill to create a new Aggregate Root for a 'Product' entity with properties like 'Name', 'Price', and 'StockQuantity'.

Frequently Asked Questions about Domain-Driven Design (DDD) in .NET - Basics & Patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement an Aggregate Root in .NET for domain-driven design?

To implement an Aggregate Root in .NET, you encapsulate all business rules and state transitions within the entity, ensuring properties like Name, Price, and StockQuantity are modified only through controlled methods to maintain testable and maintainable domain logic.

What is the best way to separate read and write operations in a .NET application?

The best way to separate read and write operations in .NET is using CQRS, which optimizes command and query handling to create clean, testable codebases by ensuring distinct paths for state modifications and data retrieval.

How does hexagonal architecture work with .NET domain entities?

Hexagonal architecture in .NET isolates domain entities and business logic from external concerns by using ports and adapters, facilitating the creation of clean, testable, and maintainable codebases independent of infrastructure.

Can I use Paramore.Brighter for command handling in a .NET DDD project?

Yes, you can use Paramore.Brighter for command and query handling in .NET, as it facilitates the separation of concerns required by CQRS and integrates smoothly with domain exceptions and repository patterns.

How do I handle deterministic time control when testing domain logic in .NET?

To achieve deterministic time control in .NET testing, you abstract time handling within your domain logic, allowing tests to manipulate time progression and verify state transitions without relying on system clocks.

When should I use domain exceptions in .NET application design?

You should use domain exceptions in .NET when business rules are violated within an Aggregate, encapsulating the error state to maintain robust software and ensure invalid state transitions are caught early.