Пример #1
0
        public Task HandleAsync(IDomainEvent <ResourceCreationSagaId, ResourceCreationStartedEvent> domainEvent)
        {
            var operation = new OperationsProjection(domainEvent.AggregateEvent.ResourceId.GetGuid(), 0, 0, domainEvent.AggregateEvent.StartedAt);

            _operations.Add(operation);
            return(Task.CompletedTask);
        }
Пример #2
0
        public Task HandleAsync(IDomainEvent <ResourceCreationSagaId, ResourceCreationEndedEvent> domainEvent)
        {
            var oldOperation = _operations.Single(x => x.Id == domainEvent.AggregateEvent.ResourceId.GetGuid());
            var operation    = new OperationsProjection(domainEvent.AggregateEvent.ResourceId.GetGuid(), domainEvent.AggregateEvent.Progress, domainEvent.AggregateEvent.Elapsed, oldOperation.StartedAt);

            _operations.RemoveAll(x => x.Id == domainEvent.AggregateEvent.ResourceId.GetGuid());
            _operations.Add(operation);
            return(Task.CompletedTask);
        }