Interface IChangeSetHandler
- Namespace
- Stratara.Abstractions.EventSourcing
- Assembly
- Stratara.Abstractions.dll
Diffs an in-flight update-command against the current aggregate state to produce a minimal change-set, then applies the change-set by emitting one field-change event per modified property. Used by the framework's generic update pipeline.
public interface IChangeSetHandler
- Extension Methods
Methods
ApplyChangeSetAsync<TAggregate>(Guid, IReadOnlyList<ChangeDetail>, CancellationToken)
Apply a previously-computed change-set by appending one field-change event per entry to the aggregate's event stream.
Task ApplyChangeSetAsync<TAggregate>(Guid aggregateId, IReadOnlyList<ChangeDetail> changeSet, CancellationToken cancellationToken = default) where TAggregate : class, new()
Parameters
aggregateIdGuidThe aggregate's stream id.
changeSetIReadOnlyList<ChangeDetail>The change-set produced by CreateChangeSetAsync<TAggregate, TUpdateCommand>(TUpdateCommand, CancellationToken).
cancellationTokenCancellationTokenPropagated to the event-store write.
Returns
Type Parameters
TAggregateThe aggregate the change-set targets.
CreateChangeSetAsync<TAggregate, TUpdateCommand>(TUpdateCommand, CancellationToken)
Compute the change-set between command and the current state
of TAggregate.
Task<IReadOnlyList<ChangeDetail>> CreateChangeSetAsync<TAggregate, TUpdateCommand>(TUpdateCommand command, CancellationToken cancellationToken = default) where TAggregate : class, new() where TUpdateCommand : IUpdateCommand
Parameters
commandTUpdateCommandThe update command instance.
cancellationTokenCancellationTokenPropagated to the aggregate read.
Returns
- Task<IReadOnlyList<ChangeDetail>>
One ChangeDetail per modified property; empty if nothing changed.
Type Parameters
TAggregateThe aggregate the command targets.
TUpdateCommandThe concrete update-command type.