コード例 #1
0
ファイル: AllEventsPage.cs プロジェクト: CityOfLax/lax-common
 public AllEventsPage(
     GlobalPosition nextGlobalPosition,
     IReadOnlyCollection <IDomainEvent> domainEvents)
 {
     NextGlobalPosition = nextGlobalPosition;
     DomainEvents       = domainEvents;
 }
コード例 #2
0
 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));
        }