Пример #1
0
        public ExPropertyInfo SearchExProperty(string name)
        {
            var propertyArray = MType.GetProperties(/*BindingFlags.DeclaredOnly*/);

            foreach (var property in propertyArray)
            {
                if (ReflectionUtil.IsDeclare(MType, property))
                {
                    CodeAttribute propertyAttr = Attribute.GetCustomAttribute(property, typeof(CodeAttribute)) as CodeAttribute;
                    if (propertyAttr == null)
                    {
                        if (property.Name == name)
                        {
                            return(GclUtil.CreatExPropertyInfo(property, ForType));
                            //return property;
                        }
                    }
                    else
                    {
                        if (propertyAttr.Code == name)
                        {
                            return(GclUtil.CreatExPropertyInfo(property, ForType));
                            //return property;
                        }
                    }
                }
            }
            if (ParentMapping != null)
            {
                return(ParentMapping.SearchExProperty(name));
            }
            return(null);
        }
Пример #2
0
        public PropertyInfo SearchProperty(string name)
        {
            var propertyArray = MType.GetProperties(/*BindingFlags.DeclaredOnly*/);

            foreach (var property in propertyArray)
            {
                if (ReflectionUtil.IsDeclare(MType, property))
                {
                    MappingCodeAttribute propertyAttr = Attribute.GetCustomAttribute(property, typeof(MappingCodeAttribute)) as MappingCodeAttribute;
                    if (propertyAttr == null)
                    {
                        if (property.Name == name)
                        {
                            return(property);
                        }
                    }
                    else
                    {
                        if (propertyAttr.Code == name)
                        {
                            return(property);
                        }
                    }
                }
            }
            return(null);
        }
Пример #3
0
        public ExPropertyInfo SearchExProperty(string name)
        {
            var propertyArray = MType.GetProperties(/*BindingFlags.DeclaredOnly*/);

            foreach (PropertyInfo property in propertyArray)
            {
                if (ReflectionUtil.IsDeclare(MType, property))
                {
                    if (isExFieldInfoByAttr(name, property))
                    {
                        return(GclUtil.CreatExPropertyInfo(ForType.GetProperty(property.Name), ForType));
                    }

                    /*ExFieldInfo exFieldInfo = searchExFieldInfoByAttr(name, property);
                     * if (exFieldInfo != null)
                     * {
                     *  return exFieldInfo;
                     * }*/
                    /*ZCodeAttribute propertyAttr = Attribute.GetCustomAttribute(property, typeof(ZCodeAttribute)) as ZCodeAttribute;
                     * if (propertyAttr == null)
                     * {
                     *  if (property.Name == name)
                     *  {
                     *      //return ForType.GetExProperty(property.Name);
                     *      return GclUtil.CreatExPropertyInfo(ForType.GetProperty(property.Name), ForType);
                     *  }
                     * }
                     * else
                     * {
                     *  if (propertyAttr.Code == name)
                     *  {
                     *      //return ForType.GetExProperty(property.Name);
                     *      return GclUtil.CreatExPropertyInfo(ForType.GetProperty(property.Name), ForType);
                     *  }
                     * }*/
                }
            }
            if (isRootMapping())
            {
                return(null);
            }
            else
            {
                ExPropertyInfo property = ParentMapping.SearchExProperty(name);
                return(property);
            }
        }