Example #1
0
        public void AddEvents(IEnumerable <object> events)
        {
            if (events == null)
            {
                throw new ArgumentNullException(nameof(events));
            }

            foreach (var @event in events.Select(x => new ItemWithType(x)))
            {
                NewEventsCollection.Add(@event);
            }

            currentState =
                (TState)EventApplier.Apply(stateType, currentState, events.Select(x => new ItemWithType(x)));
        }
Example #2
0
        public void AddEvents(object[] events)
        {
            if (events == null)
            {
                throw new ArgumentNullException(nameof(events));
            }

            for (int i = 0; i < events.Length; i++)
            {
                NewEventsCollection.Add(new ItemWithType(events[i]));
            }

            currentState =
                (TState)EventApplier.Apply(stateType, currentState, events.Select(x => new ItemWithType(x)));
        }
Example #3
0
 private void AddEventInternal(ItemWithType @event)
 {
     NewEventsCollection.Add(@event);
     currentState = (TState)EventApplier.ApplyEvent(stateType, currentState, @event);
 }