예제 #1
0
        public async Task SaveAsync(TAggregate aggregate, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrWhiteSpace(aggregate.AggregateId))
            {
                throw new ArgumentException("AggregateId must not be null or empty");
            }

            if (aggregate.UncommittedEvents.Any())
            {
                await _eventStream.AppendAsync(aggregate.AggregateId, aggregate.UncommittedEvents, aggregate.ConcurrencyKey, cancellationToken);
            }
        }