示例#1
0
        public ObjectConfigure GetConfigure()
        {
            if (_configure != null)
            {
                return(_configure);
            }

            if (Type != typeof(ObjectConfigure))
            {
                throw new Exception($"Return type is not {nameof(ObjectConfigure)}");
            }

            if (MemberType == MemberTypes.Method)
            {
                _configure = (ObjectConfigure)((MethodInfo)Member).Invoke(_Instance, null);
            }
            else
            {
                if (MemberType == MemberTypes.Field)
                {
                    _configure = (ObjectConfigure)((FieldInfo)Member).GetValue(_Instance);
                }
                else
                {
                    _configure = (ObjectConfigure)((PropertyInfo)Member).GetValue(_Instance);
                }
            }
            return(_configure);
        }
示例#2
0
 public static IBindingExpression CreateObjectBinding(PropertyInfo propertyInfo, ObjectConfigure configure)
 {
     if (!IsEnumerable(propertyInfo.PropertyType))
     {
         return(new ObjectBindingExpression(propertyInfo, configure));
     }
     else
     {
         return(new ObjectArrayBindingExpression(propertyInfo, configure));
     }
 }
示例#3
0
 public ObjectBindingExpression(PropertyInfo propertyInfo, ObjectConfigure configure) : base(propertyInfo)
 {
     Configure = configure;
 }