示例#1
0
        public Task <AllCommittedEventsPage> LoadAllCommittedEvents(
            GlobalPosition globalPosition,
            int pageSize,
            CancellationToken cancellationToken)
        {
            IReadOnlyCollection <LiteDbEvent> result;

            if (globalPosition.IsStart)
            {
                result = this.collection.Find(LiteDB.Query.All(), limit: pageSize).ToImmutableArray();
            }
            else
            {
                var id = new ObjectId(globalPosition.Value);
                result = this.collection.Find(e => e.Id > id, limit: pageSize).ToImmutableArray();
            }

            var position = new GlobalPosition(result.LastOrDefault()?.Id.ToString());
            var page     = new AllCommittedEventsPage(position, result);

            return(Task.FromResult(page));
        }
示例#2
0
 public async Task OnGetAsync()
 {
     DomainEventsPage = await QueryProcessor.ProcessAsync(
         new GetAllDomainEventsQuery(), CancellationToken.None);
 }