Class ProjectionAggregateRootStateProvider<TState>
- Namespace
- Cratis.Chronicle.Aggregates
- Assembly
- Cratis.Chronicle.dll
Represents an implementation of IAggregateRootStateProvider<TState> using a projection.
public class ProjectionAggregateRootStateProvider<TState> : IAggregateRootStateProvider<TState>
Type Parameters
TState
Type of state for the aggregate root.
- Inheritance
-
ProjectionAggregateRootStateProvider<TState>
- Implements
-
IAggregateRootStateProvider<TState>
- Inherited Members
Remarks
Initializes a new instance of the ProjectionAggregateRootStateProvider<TState> class.
Constructors
ProjectionAggregateRootStateProvider(IAggregateRootContext, IProjections)
Represents an implementation of IAggregateRootStateProvider<TState> using a projection.
public ProjectionAggregateRootStateProvider(IAggregateRootContext aggregateRootContext, IProjections projections)
Parameters
aggregateRootContext
IAggregateRootContextThe AggregateRoot the state is for.
projections
IProjectionsIProjections to use for getting state.
Remarks
Initializes a new instance of the ProjectionAggregateRootStateProvider<TState> class.
Methods
Dehydrate()
Dehydrate any state.
public Task Dehydrate()
Returns
- Task
Awaitable task.
Provide()
Handle state for an AggregateRoot.
public Task<TState?> Provide()
Returns
- Task<TState>
State provided.
Update(TState?, IEnumerable<object>)
Update the state of an AggregateRoot with events.
public Task<TState?> Update(TState? initialState, IEnumerable<object> events)
Parameters
initialState
TStateThe initial state to update from.
events
IEnumerable<object>The events to update with.
Returns
- Task<TState>
Updated state.