protected BaseRepoSession(IHoldAllConfiguration configuration, IDisposable disposableHandle) { this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.disposableHandle = disposableHandle; NewEventsCollection = configuration.CollectionTypeSelector(stateType)(); currentState = default(TState); this.eventPublisher = configuration.EventPublisher; EventApplier = this.configuration.EventApplier; }
IConfigureUpconverter IConfigureEventAppliers.WithEventApplier(IApplyEventsToStates eventApplier) { EventApplier = eventApplier; StateFactory.WarmupWith(eventApplier.SupportedStateTypes); return(this); }
public IConfigureUpconverter WithEventApplier(IApplyEventsToStates eventApplier) => applierCollection.Count == 0 ? baseConfiguration.WithEventApplier(eventApplier) : throw new Exception( $"Items already configured. Please either provide an instance of {nameof(IApplyEventsToStates)} or manually configure\\add each {typeof(IApplyEvents<>).Name}");