예제 #1
0
 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))));
 }
예제 #2
0
 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()));
 }
예제 #3
0
파일: EventStore.cs 프로젝트: xKloc/Memoir
        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)));
        }
예제 #4
0
 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)));
 }