Esempio n. 1
0
        public async Task SaveAsync(Starship aggregate, CancellationToken cancellationToken)
        {
            await _elasticClient.IndexAsync(aggregate, g => g.Index(DEFAULT_INDEX).Id(aggregate.Id), cancellationToken);

            var evts = aggregate.GetUncommittedEvents();

            if (evts.Any())
            {
                await _eventStore.AppendEventAsync(evts, cancellationToken);

                aggregate.ClearUncommittedEvents();
            }
        }