Table of Contents

Class AggregateRootFactory

Namespace
Cratis.Chronicle.Aggregates
Assembly
Cratis.Chronicle.dll

Represents an implementation of IAggregateRootFactory.

public class AggregateRootFactory : IAggregateRootFactory
Inheritance
AggregateRootFactory
Implements
Inherited Members

Remarks

Initializes a new instance of the AggregateRootFactory class.

Constructors

AggregateRootFactory(IEventStore, IAggregateRootMutatorFactory, IUnitOfWorkManager, IServiceProvider)

Represents an implementation of IAggregateRootFactory.

public AggregateRootFactory(IEventStore eventStore, IAggregateRootMutatorFactory mutatorFactory, IUnitOfWorkManager unitOfWorkManager, IServiceProvider serviceProvider)

Parameters

eventStore IEventStore

IEventStore to get event sequence to work with.

mutatorFactory IAggregateRootMutatorFactory

IAggregateRootMutatorFactory for creating mutators.

unitOfWorkManager IUnitOfWorkManager

IUnitOfWorkManager for managing units of work.

serviceProvider IServiceProvider

IServiceProvider for creating instances.

Remarks

Initializes a new instance of the AggregateRootFactory class.

Methods

Get<TAggregateRoot>(EventSourceId, EventStreamId?, EventSourceType?)

Get an instance of an IAggregateRoot for a specific EventSourceId.

public Task<TAggregateRoot> Get<TAggregateRoot>(EventSourceId id, EventStreamId? streamId = null, EventSourceType? eventSourceType = null) where TAggregateRoot : IAggregateRoot

Parameters

id EventSourceId

EventSourceId to get.

streamId EventStreamId

Optional EventStreamId to get. Will default to Default.

eventSourceType EventSourceType

Optional EventSourceType for the context. Will default to Default.

Returns

Task<TAggregateRoot>

The aggregate root instance.

Type Parameters

TAggregateRoot

Type of IAggregateRoot to get.

Remarks

If the aggregate has event handler methods, the events for the specified EventSourceId will be retrieved and the event handler methods will be invoked.