Class Aggregate<TKey, TEvent>
- Namespace
- Savvyio.Domain
- Assembly
- Savvyio.Domain.dll
Represents the base class from which all implementations of an Aggregate Root (as specified in Domain Driven Design) should derive.
public abstract class Aggregate<TKey, TEvent> : Entity<TKey>, IEntity<TKey>, IIdentity<TKey>, IMetadata
Type Parameters
TKey
The type of the key that uniquely identifies this aggregate.
TEvent
The type of the event that implements the IDomainEvent interface.
- Inheritance
-
ObjectEntity<TKey>Aggregate<TKey, TEvent>
- Derived
- Inherited Members
Constructors
Aggregate(TKey)
Initializes a new instance of the Aggregate<TKey, TEvent> class.
protected Aggregate(TKey id)
Parameters
id
TKeyThe identifier of the entity.
Aggregate(IMetadata)
Initializes a new instance of the Aggregate<TKey, TEvent> class.
protected Aggregate(IMetadata metadata = null)
Parameters
metadata
IMetadataThe optional metadata to merge with this instance.
Properties
Events
Gets the events that was added to the Aggregate.
public IReadOnlyList<TEvent> Events { get; }
Property Value
- IReadOnlyList<TEvent>
The events added to the Aggregate.
Metadata
Gets the associated metadata of this Aggregate.
public IMetadataDictionary Metadata { get; }
Property Value
- IMetadataDictionary
The associated metadata of this Aggregate.
Methods
AddEvent(TEvent)
Adds an event to the Aggregate.
protected virtual void AddEvent(TEvent e)
Parameters
e
TEventThe event to be added to the end of Events.
RemoveAllEvents()
Removes all events from the Aggregate.
public void RemoveAllEvents()
See Also
Entity<TKey>