Пример #1
0
        public async Task Add(params Event[] events)
        {
            using var scope = logger.MethodScope(nameof(EventStream), nameof(EventStream.Add));

            if (events is null)
            {
                logger.AttemptToAddNullEvents(StreamName); throw new ArgumentNullException(nameof(events));
            }
            if (events.Length == 0)
            {
                logger.AttemptToAddEmptyEvents(StreamName); throw new ArgumentException("There must be at least one event to add to the stream.", nameof(events));
            }

            await store.AddEventsToStream(StreamName, events);

            logger.AddedEvents(StreamName, events.Length);
        }