示例#1
0
        private RuleAwareEntity GetComplexDynamicPropertyInstance(string complexProperty, out string instanceProperty)
        {
            instanceProperty = string.Empty;
            RuleAwareEntity obj   = this;
            var             props = complexProperty.Split('.');

            instanceProperty = props[props.Length - 1];
            for (int i = 0; i <= props.Length - 2; i++)
            {
                string part = props[i];

                if (obj == null)
                {
                    return(null);
                }

                var dynamicRule = obj as RuleAwareEntity;
                if (dynamicRule == null)
                {
                    return(null);
                }
                var gg = dynamicRule.Prop(part).GetType();
                obj = dynamicRule.Prop(part) as RuleAwareEntity;
            }


            return(obj);
        }
示例#2
0
        private bool TrySetComplexProperty(string property, object value)
        {
            if (TrySetInstanceProperty(property, value))
            {
                return(true);
            }
            string          propertyToSet;
            RuleAwareEntity ruleEntity = GetComplexDynamicPropertyInstance(property, out propertyToSet);

            if (ruleEntity != null)
            {
                return(ruleEntity.SetPropertyValue(propertyToSet, value));
            }
            return(false);
        }