Exemplo n.º 1
0
        public virtual void ForeachProperty(string parentName, string modelName, System.Action <string, System.Type> OnProperty)
        {
            int index = IndexOfModel(string.IsNullOrEmpty(parentName) ? modelName : parentName);

            if (index == -1)
            {
                return;
            }

            System.Type modelType;
            if (string.IsNullOrEmpty(parentName))
            {
                modelType = modelTypeList[index];
            }
            else
            {
                PropertyInfo modelPropertyInfo = modelTypeList[index].GetProperty(modelName, modelPropertyFlags);
                if (modelPropertyInfo == null)
                {
                    return;
                }
                modelType = modelPropertyInfo.PropertyType;
            }

            ReflectionUtility.ForeachGetClassProperty(modelType, (propertyInfo) => {
                if (propertyInfo.CanRead)
                {
                    OnProperty(propertyInfo.Name, propertyInfo.PropertyType);
                }
            });
        }
Exemplo n.º 2
0
 public virtual void ForeachProperty(int index, System.Action <string, System.Type> OnProperty)
 {
     ReflectionUtility.ForeachGetClassProperty(modelTypeList[index], (propertyInfo) => {
         if (propertyInfo.CanRead)
         {
             OnProperty(propertyInfo.Name, propertyInfo.PropertyType);
         }
     });
 }
        public virtual List <string> GetModelPropertyList(int selected)
        {
            List <string> propertyList = new List <string>();

            ReflectionUtility.ForeachGetClassProperty(modelTypeList[selected], (propertyInfo) => {
                if (propertyInfo.CanRead)
                {
                    propertyList.Add(propertyInfo.Name);
                }
            });
            return(propertyList);
        }