Class DomainEventBase
- Namespace
- Compendium.Core.Domain.Events
- Assembly
- Compendium.Core.dll
Base class for domain events providing common properties and behavior.
public abstract class DomainEventBase : IDomainEvent
- Inheritance
-
DomainEventBase
- Implements
- Inherited Members
Constructors
DomainEventBase(Guid, string, string, DateTimeOffset, long, int)
Initializes a new instance of the DomainEventBase class for deserialization. This constructor restores all properties from serialized data.
[JsonConstructor]
protected DomainEventBase(Guid EventId, string AggregateId, string AggregateType, DateTimeOffset OccurredOn, long AggregateVersion, int EventVersion)
Parameters
EventIdGuidAggregateIdstringAggregateTypestringOccurredOnDateTimeOffsetAggregateVersionlongEventVersionint
DomainEventBase(string, string, long, int)
Initializes a new instance of the DomainEventBase class for creating new events.
protected DomainEventBase(string aggregateId, string aggregateType, long aggregateVersion, int eventVersion = 1)
Parameters
aggregateIdstringThe identifier of the aggregate that raised the event.
aggregateTypestringThe type name of the aggregate that raised the event.
aggregateVersionlongThe version of the aggregate when the event was raised.
eventVersionintThe version of the event schema (default: 1).
Properties
AggregateId
Gets the identifier of the aggregate that raised the event.
public string AggregateId { get; }
Property Value
AggregateType
Gets the type name of the aggregate that raised the event.
public string AggregateType { get; }
Property Value
AggregateVersion
Gets the version of the aggregate when the event was raised.
public long AggregateVersion { get; }
Property Value
EventId
Gets the unique identifier of the event.
public Guid EventId { get; }
Property Value
EventVersion
Gets the version of the event schema. This allows for event schema evolution while maintaining backward compatibility. Default value is 1 for events created before versioning was introduced.
public int EventVersion { get; }
Property Value
OccurredOn
Gets the timestamp when the event occurred.
public DateTimeOffset OccurredOn { get; }
Property Value
Methods
ToString()
Returns a string representation of the domain event.
public override string ToString()
Returns
- string
A string that represents the current domain event.