What problem does it solve?
This Skill captures proven patterns and guardrails for designing and implementing event-sourced aggregate roots in .NET command microservices, preventing common mistakes like public setters, constructor-based creation, and incorrect sequence handling.
Core Features & Use Cases
- Aggregate base pattern: guidance for a generic Aggregate<T> base that uses dynamic dispatch to route events to typed Apply overloads.
- Event lifecycle rules: best practices for ApplyChange semantics, sequence validation, setting aggregate Id on the first event, and tracking uncommitted events for persistence.
- Creation and replay: patterns for factory-based aggregate creation, LoadFromHistory replay without marking events as new, and committing new events via a commit service.
- Anti-patterns and detection: lists common anti-patterns and search commands to detect existing implementations and integration steps to add aggregates to a project.
- Use cases: creating new domain entities, adding behaviors to existing aggregates, and enforcing domain invariants inside aggregate methods.
Quick Start
Ask the AI to design an Order aggregate implementing event sourcing with factory creation, typed Apply handlers, LoadFromHistory replay, sequence validation, and uncommitted event tracking for your .NET command microservice.