示例#1
0
        public async Task AppendEventsAsync(IReadOnlyCollection <IEvent> events)
        {
            if (events == null)
            {
                throw new ArgumentNullException(nameof(events));
            }

            // persist events in Event Store
            await _store.Streams[_streamName].AppendManyAsync(events);

            // forward events to indices so they can update their state
            foreach (var ev in events)
            {
                _cache.ApplyEvent(ev);
            }
        }