public List <Operation> CreateFor(LocalEventsBatch batch) { return(batch.Events.Cast <dynamic>() .Select(it => this.CreateOperation(it)) .Where(it => it != null) .Cast <Operation>() .ToList()); }
public async Task Handle(LocalEventsBatch 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()); }