Skip to main content
Table of Contents

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

aggregateId Guid

The aggregate's stream id.

changeSet IReadOnlyList<ChangeDetail>

The change-set produced by CreateChangeSetAsync<TAggregate, TUpdateCommand>(TUpdateCommand, CancellationToken).

cancellationToken CancellationToken

Propagated to the event-store write.

Returns

Task

Type Parameters

TAggregate

The 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

command TUpdateCommand

The update command instance.

cancellationToken CancellationToken

Propagated to the aggregate read.

Returns

Task<IReadOnlyList<ChangeDetail>>

One ChangeDetail per modified property; empty if nothing changed.

Type Parameters

TAggregate

The aggregate the command targets.

TUpdateCommand

The concrete update-command type.