コード例 #1
0
 public List <Operation> CreateFor(ServerEventsBatch batch)
 {
     return(batch.Events.Cast <dynamic>()
            .Select(it => this.CreateOperation(it))
            .Where(it => it != null)
            .Cast <Operation>()
            .ToList());
 }
コード例 #2
0
        public async Task Handle(ServerEventsBatch batch)
        {
            var commands = this.operationsFactory.CreateFor(batch);

            foreach (var operation in commands)
            {
                this.EnqueOperation(operation);
            }

            await Task.WhenAll(commands.Select(it => it.CompletionSource.Task).ToArray());

            // notify batch completed

            this.aggregator.Publish(new DropBoxBatchCompleted());
        }