static void TrySetCorrelationPropertyValue(ISagaData newSagaData, CorrelationProperty correlationProperty, object body, ITransactionContext transactionContext) { try { if (IgnoredProperties.Contains(correlationProperty.PropertyName)) { return; } var correlationPropertyInfo = newSagaData.GetType().GetProperty(correlationProperty.PropertyName); if (correlationPropertyInfo == null) { return; } var valueFromMessage = correlationProperty.ValueFromMessage(new MessageContext(transactionContext), body); correlationPropertyInfo.SetValue(newSagaData, valueFromMessage); } catch (Exception) { // if this fails it might be because the property is not settable.... just leave it to the programmer in the other end to set it } }
static void TrySetCorrelationPropertyValue(ISagaData newSagaData, CorrelationProperty correlationProperty, object body) { try { var correlationPropertyInfo = newSagaData.GetType().GetProperty(correlationProperty.PropertyName); if (correlationPropertyInfo == null) return; var valueFromMessage = correlationProperty.ValueFromMessage(body); correlationPropertyInfo.SetValue(newSagaData, valueFromMessage); } catch(Exception) { // if this fails it might be because the property is not settable.... just leave it to the programmer in the other end to set it } }