/// <summary> /// Initializes a new instance of the <see cref="EventSource"/> class. /// </summary> /// <param name="eventStore">The event store.</param> /// <param name="snapshotStore">The snapshot store.</param> /// <param name="eventDispatcher">The event dispatcher.</param> /// <param name="factory">The factory.</param> public EventSource(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore, Action <IEnumerable <Event> > eventDispatcher, Func <Type, AggregateRoot> factory) { _eventStore = eventStore; _snapshotStore = snapshotStore; _eventDispatcher = eventDispatcher; _factory = factory; }
/// <summary> /// Initializes a new instance of the <see cref="AggregateRootRepository"/> class. /// </summary> /// <param name="eventStore">The event store.</param> /// <param name="snapshotStore">The snapshot store.</param> /// <param name="eventDispatcher">The event dispatcher.</param> /// <param name="factory">The factory.</param> public AggregateRootRepository(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore, Action <IEnumerable <Event> > eventDispatcher, Func <Type, AggregateRoot> factory) { if (eventStore == null) { throw new ArgumentNullException("eventStore"); } _eventStore = eventStore; _batchedEventStore = (eventStore as IBatchedEventStore); _snapshotStore = snapshotStore; _batchedSnapshotStore = (snapshotStore as IBatchedAggregateRootSnapshotStore); _eventDispatcher = eventDispatcher; _factory = (factory ?? EventSource.DefaultFactory.Factory); }
/// <summary> /// Initializes a new instance of the <see cref="AggregateRootRepository"/> class. /// </summary> /// <param name="eventStore">The event store.</param> /// <param name="snapshotStore">The snapshot store.</param> /// <param name="eventDispatcher">The event dispatcher.</param> public AggregateRootRepository(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore, Action <IEnumerable <Event> > eventDispatcher) : this(eventStore, snapshotStore, eventDispatcher, EventSource.DefaultFactory.Factory) { }
/// <summary> /// Initializes a new instance of the <see cref="AggregateRootRepository"/> class. /// </summary> /// <param name="eventStore">The event store.</param> /// <param name="snapshotStore">The snapshot store.</param> public AggregateRootRepository(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore) : this(eventStore, snapshotStore, null, EventSource.DefaultFactory.Factory) { }
public void Initialize() { AggregateRootSnapshotStore = CreateAggregateRootSnapshotStore(); }
/// <summary> /// Initializes a new instance of the <see cref="EventSource"/> class. /// </summary> /// <param name="eventStore">The event store.</param> /// <param name="snapshotStore">The snapshot store.</param> public EventSource(IEventStore eventStore, IAggregateRootSnapshotStore snapshotStore) : this(eventStore, snapshotStore, null, DefaultFactory.Factory) { }