public void ConfigureMapping <TMessage>(Expression <Func <TMessage, object> > messageProperty) { if (sagaEntityProperty == null) { throw new Exception($"The saga '{sagaType.FullName}' has not defined a CorrelationPropertyName, so it is expected that a {nameof(IFindSagas<TSagaData>)} will be defined for all messages the saga handles."); } Guard.AgainstNull(nameof(messageProperty), messageProperty); sagaMessageFindingConfiguration.ConfigureMapping(sagaEntityProperty, messageProperty); }
/// <summary> /// Defines the property on the saga data to which the message property should be mapped /// </summary> /// <param name="sagaEntityProperty">The property to map</param> public void ToSaga(Expression <Func <TSaga, object> > sagaEntityProperty) { sagaMessageFindingConfiguration.ConfigureMapping(sagaEntityProperty, messageProperty); }
protected override void ConfigureHowToFindSaga(IConfigureHowToFindSagaWithMessage mapper) { mapper.ConfigureMapping <PaymentSagaData, RequestPayment>(message => message.PaymentId, payment => payment.PaymentId); mapper.ConfigureMapping <PaymentSagaData, CompletePayment>(message => message.PaymentId, payment => payment.PaymentId); mapper.ConfigureMapping <PaymentSagaData, CancelPayment>(message => message.PaymentId, payment => payment.PaymentId); }