Represents a mapping from a field of an incoming message of a specific type to a specific property on a specific type of saga data
Наследование: ISagaCorrelationProperty
Пример #1
0
        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
            }
        }
Пример #2
0
        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
            }
        }