public void Handle(AccountValueChanged evt) { if (!evt.SagaId.HasValue) { return; } var creating = sagas.GetById <AccountValueTranferring>(evt.SagaId.Value); creating.Transition(evt); Save(creating, @by: evt); }
void Apply(AccountValueChanged evt) { value += evt.ValueDifference; if (evt.SagaId.HasValue) { Guid transactionId = evt.SagaId.Value; decimal transferredValue; transferredValues.TryGetValue(transactionId, out transferredValue); transferredValue += evt.ValueDifference; transferredValues[transactionId] = transferredValue; } }
void Apply(AccountValueChanged evt) { if (failed) { return; } if (evt.Id == from) { Dispatch(new ChangeAccountValue { Id = to, Value = transferredValue }); } if (evt.Id == to) { // Tranferring is completed } }