Class TracedAggregateRoot<TKey>
- Namespace
- Savvyio.Domain.EventSourcing
- Assembly
- Savvyio.Domain.EventSourcing.dll
Provides a way to cover the pattern of an Aggregate as specified in Domain Driven Design that is optimized for Event Sourcing. This is an abstract class.
public abstract class TracedAggregateRoot<TKey> : Aggregate<TKey, ITracedDomainEvent>, ITracedAggregateRoot<TKey>, IAggregateRoot<ITracedDomainEvent>, IAggregateRoot, IMetadata, IEntity<TKey>, IIdentity<TKey>
Type Parameters
TKey
The type of the key that uniquely identifies this aggregate.
- Inheritance
-
ObjectEntity<TKey>Aggregate<TKey, ITracedDomainEvent>TracedAggregateRoot<TKey>
- Implements
-
ITracedAggregateRoot<TKey>IEntity<TKey>IIdentity<TKey>
- Inherited Members
Constructors
TracedAggregateRoot(TKey, IEnumerable<ITracedDomainEvent>)
Initializes a new instance of the TracedAggregateRoot<TKey> class.
protected TracedAggregateRoot(TKey id, IEnumerable<ITracedDomainEvent> events)
Parameters
id
TKeyThe identifier of the entity.
events
IEnumerable<ITracedDomainEvent>The events to rehydrate from.
TracedAggregateRoot(IMetadata)
Initializes a new instance of the TracedAggregateRoot<TKey> class.
protected TracedAggregateRoot(IMetadata metadata = null)
Parameters
metadata
IMetadataThe optional metadata to merge with this instance.
Properties
Version
Gets the version of the Aggregate.
public long Version { get; }
Property Value
- Int64
The version of the Aggregate.
Methods
AddEvent(ITracedDomainEvent)
Adds an event to the Aggregate.
protected sealed override void AddEvent(ITracedDomainEvent e)
Parameters
e
ITracedDomainEventThe event to be added to the end of Events.
RegisterDelegates(IFireForgetRegistry<ITracedDomainEvent>)
Registers the delegates responsible for handling types that implements the ITracedDomainEvent interface.
protected abstract void RegisterDelegates(IFireForgetRegistry<ITracedDomainEvent> handler)
Parameters
handler
IFireForgetRegistry<ITracedDomainEvent>The registry that store the delegates of type ITracedDomainEvent.