Interface IDomainEvent
Core interface for all domain events in the system. Combines dispatch messaging capabilities with event sourcing metadata.
public interface IDomainEvent : IDispatchEvent, IDispatchMessage
- Extension Methods
Remarks
Domain events capture important business occurrences within an aggregate or entity. They should be named using past-tense verbs (e.g., OrderPlaced, PaymentReceived). Domain events typically remain within the bounded context and are used for:
- Triggering side effects within the same bounded context
- Maintaining read model projections
- Supporting event sourcing patterns
Properties
CausationId
Gets the causation ID identifying the command or event that directly caused this event.
string? CausationId { get; }
Property Value
Remarks
Reads CausationId (the framework's declared key, and what every framework write path now writes), falling back to the legacy "CausationId"/"causationId" spellings for events persisted before those two keys were unified with this one.
CorrelationId
Gets the correlation ID for tracking a chain of related operations across services.
string? CorrelationId { get; }
Property Value
Remarks
Reads CorrelationId (the framework's declared key, and what every framework write path now writes), falling back to the legacy "CorrelationId"/"correlationId" spellings for events persisted before those two keys were unified with this one.
EventId
Gets the unique identifier for this event instance.
string EventId { get; }
Property Value
- string
The unique identifier for this event instance.
Metadata
Gets optional metadata for cross-cutting concerns. Examples: UserId, TenantId, custom tags.
IDictionary<string, object>? Metadata { get; }
Property Value
- IDictionary<string, object>
Optional metadata for cross-cutting concerns.
OccurredAt
Gets the UTC timestamp when this event occurred.
DateTimeOffset OccurredAt { get; }
Property Value
- DateTimeOffset
The UTC timestamp when this event occurred.