domain-entity

Create .NET domain entities with DDD validation and EF Core configuration.

Updated Feb 26, 2023
One-click install
npx skills add https://github.com/burakergun394/projects --skill domain-entity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-entity
Source: https://github.com/burakergun394/projects/tree/main/FollowCatcher/.claude/skills/domain-entity
Command: npx skills add https://github.com/burakergun394/projects --skill domain-entity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create consistent domain entity templates following DDD principles, enabling rapid, correct scaffolding for new domain models and reducing boilerplate.

Core Features & Use Cases

  • Provides a standard domain entity template with required constructors, validation, and behavior methods.
  • Includes guidance for integrating value objects, domain events, and EF Core configuration.
  • Use Case: when adding a new entity to an aggregate or introducing a new domain feature, this guide ensures consistent design and implementation.

Quick Start

Create a new domain entity following the DDD guidelines outlined in this guide.

Frequently Asked Questions about domain-entity

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

FAQPage Schema
How do I create a DDD aggregate entity with EF Core in C#?

To create a DDD aggregate entity in C# with EF Core, define a public constructor for domain validation and a private constructor for EF Core hydration. This ensures domain model consistency while supporting persistence and domain event integration.

What is the best way to implement value objects in .NET domain-driven design?

Implementing value objects in .NET domain-driven design involves encapsulating domain concepts with strict validation and integrating them into entities. Standard EF Core configuration guidance ensures proper persistence and consistency across typical business domains.

How do I add domain events to a .NET aggregate root?

To add domain events to a .NET aggregate root, raise events within entity behavior methods during state changes. This keeps domain logic encapsulated while allowing downstream integration for typical business domain workflows.

Does EF Core work with private constructors for domain entities?

Yes, EF Core works with private constructors for domain entities by using reflection to hydrate objects without bypassing domain validation. This maintains strict DDD principles while ensuring smooth database persistence operations.

Why do I need both public and private constructors for domain entities?

You need both public and private constructors for domain entities to separate domain creation with validation from infrastructure hydration. The public constructor enforces business rules, while the private one allows EF Core to load data without violating DDD invariants.