예제 #1
0
        internal bool TryGetCorrelationProperty(out CorrelationPropertyInfo sagaCorrelationProperty)
        {
            sagaCorrelationProperty = correlationProperty;


            return(sagaCorrelationProperty != null);
        }
예제 #2
0
        void AttachEntity(IContainSagaData sagaEntity)
        {
            sagaId = sagaEntity.Id;
            UpdateModified();
            Instance.Entity = sagaEntity;
            SagaId          = sagaEntity.Id.ToString();

            var properties = sagaEntity.GetType().GetProperties();

            SagaMetadata.CorrelationPropertyMetadata correlatedPropertyMetadata;

            if (Metadata.TryGetCorrelationProperty(out correlatedPropertyMetadata))
            {
                var propertyInfo  = properties.Single(p => p.Name == correlatedPropertyMetadata.Name);
                var propertyValue = propertyInfo.GetValue(sagaEntity);

                var defaultValue = GetDefault(propertyInfo.PropertyType);

                var hasValue = propertyValue != null && !propertyValue.Equals(defaultValue);

                correlationProperty = new CorrelationPropertyInfo
                {
                    PropertyInfo     = propertyInfo,
                    Value            = propertyValue,
                    HasExistingValue = hasValue
                };
            }
        }
예제 #3
0
        internal bool TryGetCorrelationProperty(out CorrelationPropertyInfo sagaCorrelationProperty)
        {
            sagaCorrelationProperty = correlationProperty;


            return sagaCorrelationProperty != null;
        }
예제 #4
0
        void AttachEntity(IContainSagaData sagaEntity)
        {
            sagaId = sagaEntity.Id;
            UpdateModified();
            Instance.Entity = sagaEntity;
            SagaId = sagaEntity.Id.ToString();

            var properties = sagaEntity.GetType().GetProperties();
            SagaMetadata.CorrelationPropertyMetadata correlatedPropertyMetadata;

            if (Metadata.TryGetCorrelationProperty(out correlatedPropertyMetadata))
            {
                var propertyInfo = properties.Single(p => p.Name == correlatedPropertyMetadata.Name);
                var propertyValue = propertyInfo.GetValue(sagaEntity);

                var defaultValue = GetDefault(propertyInfo.PropertyType);

                var hasValue = propertyValue != null && !propertyValue.Equals(defaultValue);

                correlationProperty = new CorrelationPropertyInfo
                {
                    PropertyInfo = propertyInfo,
                    Value = propertyValue,
                    HasExistingValue = hasValue
                };
            }
        }