public Task <IEnumerable <IRecordedEvent> > GetEvents <T>(long fromEventNumber, int maxCount) where T : IEvent { return(Task.FromResult(Transform(Events.Where(e => e.EventNumber >= fromEventNumber && e.EventType == _typeMapper.GetEventName <T>()).Take(maxCount)))); }
public IPendingEvent Create <T>(T aggregate, IEvent @event) where T : IAggregate <T> { return(new PendingEvent(Guid.NewGuid(), _typeMapper.GetEventName(@event.GetType()), aggregate.Id, _typeMapper.GetAggregateName <T>(), @event, new EmptyMetadata())); }
public virtual Task <IEnumerable <IRecordedEvent <TEvent, TState> > > GetEvents <TEvent, TState>(long fromEventNumber, int maxCount) where TEvent : IEvent <TState> { var query = $"SELECT TOP ({maxCount}) {_eventColumns} FROM {_options.EventsTableName} WHERE EventNumber >= {fromEventNumber} AND EventType = '{_typeMapper.GetEventName<TEvent, TState>()}'"; return(Task.Run(() => QueryEvents <TEvent, TState>(query))); }
public IPendingEvent Create <TAggregate, TState>(TAggregate aggregate, IEvent <TState> @event) where TAggregate : IAggregate <TState> { return(new PendingEvent(Guid.NewGuid(), _typeMapper.GetEventName(@event.GetType()), aggregate.GetId(), _typeMapper.GetAggregateName <TAggregate, TState>(), @event, _metadataFactory.Create <TAggregate, TState>(aggregate))); }