Table of Contents

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

EventId Guid
AggregateId string
AggregateType string
OccurredOn DateTimeOffset
AggregateVersion long
EventVersion int

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

aggregateId string

The identifier of the aggregate that raised the event.

aggregateType string

The type name of the aggregate that raised the event.

aggregateVersion long

The version of the aggregate when the event was raised.

eventVersion int

The 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

string

AggregateType

Gets the type name of the aggregate that raised the event.

public string AggregateType { get; }

Property Value

string

AggregateVersion

Gets the version of the aggregate when the event was raised.

public long AggregateVersion { get; }

Property Value

long

EventId

Gets the unique identifier of the event.

public Guid EventId { get; }

Property Value

Guid

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

int

OccurredOn

Gets the timestamp when the event occurred.

public DateTimeOffset OccurredOn { get; }

Property Value

DateTimeOffset

Methods

ToString()

Returns a string representation of the domain event.

public override string ToString()

Returns

string

A string that represents the current domain event.