public EventStoreRepository(IValidateState <TState> stateValidator, IHoldAllConfiguration configs, IEventStoreConnection connection, IDateTimeProvider dateTimeProvider = null)
 {
     this.stateValidator   = stateValidator ?? throw new ArgumentNullException(nameof(stateValidator));
     this.configs          = configs ?? throw new ArgumentNullException(nameof(connection));
     this.connection       = connection ?? throw new ArgumentNullException(nameof(connection));
     this.dateTimeProvider = dateTimeProvider ?? new SystemDateTimeProvider();
 }
Beispiel #2
0
 public EventStoreRepository(IValidateState <TState> stateValidator, IHoldAllConfiguration configs, EventStoreClient client, IDateTimeProvider dateTimeProvider = null)
 {
     this.stateValidator   = stateValidator ?? throw new ArgumentNullException(nameof(stateValidator));
     this.configs          = configs ?? throw new ArgumentNullException(nameof(configs));
     this.eventReader      = new EventReader(client, configs);
     this.client           = client ?? throw new ArgumentNullException(nameof(client));
     this.dateTimeProvider = dateTimeProvider ?? new SystemDateTimeProvider();
 }
Beispiel #3
0
        private static void ValidateStateOrThrow(IValidateState <TState> validator, TState state)
        {
            var valResults = validator.Validate(state);

            if (!valResults.IsSuccess)
            {
                var errors = valResults.ValidationErrors.ToArray();

                throw new AggregateException(errors.Select(e => e.GetAsException()));
            }
        }
        public EventStoreSession(IValidateState <TState> stateValidator,
                                 IHoldAllConfiguration configuration,
                                 IEventStoreConnection eventStoreConnection,
                                 string streamName)
            : base(stateValidator, configuration)
        {
            this.eventStoreConnection =
                eventStoreConnection ?? throw new ArgumentNullException(nameof(eventStoreConnection));
            this.streamName = streamName ?? throw new ArgumentNullException(nameof(streamName));

            this.eventReader = new EventReader(eventStoreConnection, configuration);
        }
        public EventStoreSession(IValidateState <TState> stateValidator,
                                 IHoldAllConfiguration configuration,
                                 EventStoreClient eventStoreClientclient,
                                 string streamName,
                                 IDateTimeProvider dateTimeProvider = null)
            : base(stateValidator, configuration)
        {
            this.client =
                eventStoreClientclient ?? throw new ArgumentNullException(nameof(eventStoreClientclient));
            this.streamName       = streamName ?? throw new ArgumentNullException(nameof(streamName));
            this.dateTimeProvider = dateTimeProvider ?? new SystemDateTimeProvider();

            this.eventReader = new EventReader(client, configuration);
        }
Beispiel #6
0
        public EventStoreSession
        (
            IValidateState <TState> stateValidator,
            IHoldAllConfiguration configuration,
            IReadEventsFromStream eventReader,
            IStoreEventsToStream eventWriter,
            string streamName,
            IDateTimeProvider dateTimeProvider = null
        ) : base(stateValidator, configuration)
        {
            this.eventReader = eventReader ?? throw new ArgumentNullException(nameof(eventReader));
            this.eventWriter = eventWriter ?? throw new ArgumentNullException(nameof(eventWriter));

            this.streamName       = streamName ?? throw new ArgumentNullException(nameof(streamName));
            this.dateTimeProvider = dateTimeProvider ?? new SystemDateTimeProvider();
        }
Beispiel #7
0
        protected BaseRepoSession(IValidateState <TState> validator,
                                  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;
            stateValidator = validator ?? throw new ArgumentNullException(nameof(validator));
        }
Beispiel #8
0
 public BaseEventSourcedSession(IValidateState <TState> validator, IHoldAllConfiguration configuration, IDisposable disposableHandle = null)
     : base(validator, configuration, disposableHandle)
     => eventApplier = configuration.EventApplier;
Beispiel #9
0
 public EventStoreRepository(IValidateState <TState> stateValidator, IHoldAllConfiguration configs, IEventStoreConnection connection)
 {
     this.stateValidator = stateValidator ?? throw new ArgumentNullException(nameof(stateValidator));
     this.configs        = configs ?? throw new ArgumentNullException(nameof(connection));
     this.connection     = connection ?? throw new ArgumentNullException(nameof(connection));
 }