ข้ามไปยังเนื้อหา

Class AggregateHydrator

เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน

Namespace: Cephalon.EventSourcing.Services
Assembly: Cephalon.EventSourcing.dll

Rehydrates aggregate state by replaying domain events from an event store.

public sealed class AggregateHydrator<TAggregate, TState> where TAggregate : IAggregate<TState>, new()

TAggregate

The aggregate type that applies domain events.

TState

The aggregate state shape.

objectAggregateHydrator<TAggregate, TState>

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Initializes a new instance of the class.

public AggregateHydrator()

HydrateAsync(IEventStore, string, long, CancellationToken)

Section titled “ HydrateAsync(IEventStore, string, long, CancellationToken)”

Rehydrates one aggregate state by replaying the requested event stream.

public Task<(TState State, long Version)> HydrateAsync(IEventStore eventStore, string streamId, long fromVersion = 0, CancellationToken cancellationToken = default)

eventStore IEventStore

The event store to read from.

streamId string

The stable stream identifier.

fromVersion long

The first version to replay. The default is 0.

cancellationToken CancellationToken

The token that cancels the operation.

Task<(TState State, long Version)>

The rehydrated aggregate state and the latest version applied.