public ReflectedControllerDescriptor(string controllerName, Type controllerType)
        {
            this.controllerName = controllerName;

            this.controllerType = controllerType;

            Reflector reflector = new Reflector(controllerType);

            List<ReflectedActionDescriptor> actionDescriptorList = new List<ReflectedActionDescriptor>();

            foreach (KeyValuePair<string, MethodInfo> methodInfoKeyValue in reflector.ObjectMethods)
            {
                string methodName = methodInfoKeyValue.Key;

                MethodInfo methodInfo = methodInfoKeyValue.Value;

                ReflectedActionDescriptor actionDescriptor = new ReflectedActionDescriptor(methodInfo, methodName, this);

                actionDescriptorList.Add(actionDescriptor);
            }

            this.actionDescriptorArray = actionDescriptorList.ToArray();
        }
Beispiel #2
0
 public static PropertyInfo[] GetMatchedPropertiesForEachAttribute(object specifiedObject, Type attributeType)
 {
     List<PropertyInfo> properties = new List<PropertyInfo>();
     Reflector hepler = new Reflector(specifiedObject);
     foreach (KeyValuePair<String, PropertyInfo> item in hepler.ObjectProperties)
     {
         if (hepler.ExistAttribute(item.Key, attributeType))
         {
             properties.Add(item.Value);
         }
     }
     return properties.ToArray();
 }