Exemplo n.º 1
0
 public ReflectionConfigurator RegisterType(Type type)
 {
     AddAction(type.Name);
     foreach (MethodInfo methodInfo in type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance))
     {
         DirectMethodAttribute directMethodAttribute = _reflectionHelpers.FindAttribute(methodInfo, new DirectMethodAttribute());
         AddMethod(type.Name, pascalizeName(methodInfo.Name), type, methodInfo, directMethodAttribute.FormHandler, directMethodAttribute.NamedArguments);
     }
     return(this);
 }
Exemplo n.º 2
0
        public ReflectionConfigurator RegisterType(Type type)
        {
            AddAction(type.Name);
            var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Instance)
                          .Where(mi => mi.DeclaringType == type || _reflectionHelpers.HasAttribute <DirectMethodAttribute>(mi));

            foreach (MethodInfo methodInfo in methods)
            {
                DirectMethodAttribute directMethodAttribute = _reflectionHelpers.FindAttribute(methodInfo, new DirectMethodAttribute());
                AddMethod(type.Name, BuildMethodName(methodInfo.Name), type, methodInfo, directMethodAttribute.FormHandler, directMethodAttribute.NamedArguments);
            }
            return(this);
        }