Ejemplo n.º 1
0
        public async Task IndexAsync(AggregateCommit aggregateCommit)
        {
            List <IndexRecord> indexRecordsBatch = new List <IndexRecord>();

            foreach (var @event in aggregateCommit.Events)
            {
                string eventTypeId = @event.Unwrap().GetType().GetContractId();
                var    record      = new IndexRecord(eventTypeId, aggregateCommit.AggregateRootId);
                indexRecordsBatch.Add(record);
            }

            foreach (var publicEvent in aggregateCommit.PublicEvents)
            {
                string eventTypeId = publicEvent.GetType().GetContractId();
                var    record      = new IndexRecord(eventTypeId, aggregateCommit.AggregateRootId);
                indexRecordsBatch.Add(record);
            }

            await indexStore.ApendAsync(indexRecordsBatch).ConfigureAwait(false);
        }