Table of Contents

Interface IAggregateRoot<TAggregate, TKey>

Namespace
Excalibur.Domain.Model
Assembly
Excalibur.Domain.dll

Generic interface for strongly-typed aggregates with factory methods.

public interface IAggregateRoot<TAggregate, TKey> : IAggregateRoot<TKey>, IAggregateRoot where TAggregate : IAggregateRoot<TAggregate, TKey> where TKey : notnull

Type Parameters

TAggregate

The type of the aggregate.

TKey

The type of the aggregate identifier.

Inherited Members

Remarks

This interface provides static factory methods for creating aggregates, enabling polymorphic aggregate construction in generic repository implementations.

Methods

Create(TKey)

Creates a new instance of the aggregate.

public static abstract TAggregate Create(TKey id)

Parameters

id TKey

The unique identifier for the aggregate.

Returns

TAggregate

A new instance of the aggregate.

FromEvents(TKey, IEnumerable<HistoricEvent>)

Rebuilds the aggregate from a stream of events.

public static abstract TAggregate FromEvents(TKey id, IEnumerable<HistoricEvent> events)

Parameters

id TKey

The unique identifier for the aggregate.

events IEnumerable<HistoricEvent>

The stream of events to apply.

Returns

TAggregate

The aggregate rebuilt from the events.