What problem does it solve?
This Skill provides a consistent, production-ready pattern for defining domain events in event-sourced .NET systems, preventing divergent event shapes, fragile serialization, and ordering mistakes that break replay and migration workflows.
Core Features & Use Cases
- Typed event hierarchy: guidance for an abstract Event base class, a generic Event<TData> wrapper, and immutable IEventData records to keep payloads explicit and versionable.
- Enum-based event identification: use EventType enum values to drive EF Core discriminators and avoid brittle string identifiers.
- Sequence and versioning: enforce sequence ordering and a Version field to support schema evolution and safe replays.
- Practical use case: implement OrderCreated, OrderUpdated, and collection-modification events, convert commands to events via extension methods, and register discriminator mappings in EF Core.
Quick Start
Create an Event<TData> subclass with its IEventData record, add the corresponding EventType enum value, convert your command to the event via an extension method, and register the concrete type in your EF Core discriminator mapping.