public async Task <IEnumerable <IEvent> > GetEventsAsync(long startVersion, long endVersion)
        {
            var entities = await _loader.SelectAsync(startVersion, endVersion).ConfigureAwait(false);

            var re = entities.Select(x => _mapper.Map(x, Identity)).ToArray();

            _logger.LogDebug("found {count} events that version in range [{startVersion}, {endVersion}).",
                             re.Length,
                             startVersion,
                             endVersion);
            return(re);
        }
Ejemplo n.º 2
0
 public async Task SaveEventAsync(IEvent @event)
 {
     try
     {
         var entity = _mapper.Map(@event);
         _logger.LogDebug("start to save event to store {@eventEntity}", entity);
         await _saver.SaveAsync(entity).ConfigureAwait(false);
     }
     catch (Exception e)
     {
         throw new EventSavingException(e, @event);
     }
 }