Table of Contents

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
Object
Entity<TKey>
Aggregate<TKey, TEvent>
Implements
IEntity<TKey>
IIdentity<TKey>
Derived
Inherited Members

Constructors

Aggregate(TKey)

Initializes a new instance of the Aggregate<TKey, TEvent> class.

protected Aggregate(TKey id)

Parameters

id TKey

The identifier of the entity.

Aggregate(IMetadata)

Initializes a new instance of the Aggregate<TKey, TEvent> class.

protected Aggregate(IMetadata metadata = null)

Parameters

metadata IMetadata

The 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 TEvent

The event to be added to the end of Events.

RemoveAllEvents()

Removes all events from the Aggregate.

public void RemoveAllEvents()

See Also

Entity<TKey>