Пример #1
0
 public AllEventsPage(
     GlobalPosition nextGlobalPosition,
     IReadOnlyCollection <IDomainEvent> domainEvents)
 {
     NextGlobalPosition = nextGlobalPosition;
     DomainEvents       = domainEvents;
 }
 public AllCommittedEventsPage(
     GlobalPosition nextGlobalPosition,
     IReadOnlyCollection <ICommittedDomainEvent> committedDomainEvents)
 {
     NextGlobalPosition    = nextGlobalPosition;
     CommittedDomainEvents = committedDomainEvents;
 }
Пример #3
0
        public async Task <AllEventsPage> LoadAllEventsAsync(
            GlobalPosition globalPosition,
            int pageSize,
            CancellationToken cancellationToken)
        {
            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(pageSize));
            }

            var allCommittedEventsPage = await _eventPersistence.LoadAllCommittedEvents(
                globalPosition,
                pageSize,
                cancellationToken)
                                         .ConfigureAwait(false);

            var domainEvents = (IReadOnlyCollection <IDomainEvent>)allCommittedEventsPage.CommittedDomainEvents
                               .Select(e => _eventJsonSerializer.Deserialize(e))
                               .ToList();

            domainEvents = _eventUpgradeManager.Upgrade(domainEvents);
            return(new AllEventsPage(allCommittedEventsPage.NextGlobalPosition, domainEvents));
        }