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
IEventStoreIEventStore to get event sequence to work with.
mutatorFactory
IAggregateRootMutatorFactoryIAggregateRootMutatorFactory for creating mutators.
unitOfWorkManager
IUnitOfWorkManagerIUnitOfWorkManager for managing units of work.
serviceProvider
IServiceProviderIServiceProvider 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
EventSourceIdEventSourceId to get.
streamId
EventStreamIdOptional EventStreamId to get. Will default to Default.
eventSourceType
EventSourceTypeOptional 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.