示例#1
0
 public override bool Process(MethodInfo method, IMethodRemover methodRemover, IFacetHolder holder) {
     if ((method.ReturnType.IsPrimitive || TypeUtils.IsEnum(method.ReturnType)) && method.GetCustomAttribute<OptionallyAttribute>() != null) {
         Log.Warn("Ignoring Optionally annotation on primitive parameter on " + method.ReflectedType + "." + method.Name);
         return false;
     }
     return Process(method, holder);
 }
        public override bool Process(MethodInfo method, IMethodRemover methodRemover, IFacetHolder holder) {
            var classAttribute = method.DeclaringType.GetCustomAttributeByReflection<AuthorizeActionAttribute>();
            var methodAttribute = method.GetCustomAttribute<AuthorizeActionAttribute>();

            if (classAttribute != null && methodAttribute != null) {
                Log.WarnFormat("Class and method level AuthorizeAttributes applied to class {0} - ignoring attribute on method {1}", method.DeclaringType.FullName, method.Name);
            }

            return Create(classAttribute ?? methodAttribute, holder);
        }
示例#3
0
 public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     if ((parameter.ParameterType.IsPrimitive || TypeUtils.IsEnum(parameter.ParameterType))) {
         if (method.GetCustomAttribute<OptionallyAttribute>() != null) {
             Log.Warn("Ignoring Optionally annotation on primitive parameter " + paramNum + " on " + method.ReflectedType + "." +
                      method.Name);
         }
         return false;
     }
     var attribute = parameter.GetCustomAttributeByReflection<OptionallyAttribute>();
     return FacetUtils.AddFacet(Create(attribute, holder));
 }
 public override bool Process(MethodInfo method, IMethodRemover methodRemover, IFacetHolder holder) {
     Attribute attribute = method.GetCustomAttribute<DisplayNameAttribute>() ?? (Attribute) method.GetCustomAttribute<NamedAttribute>();
     return FacetUtils.AddFacet(Create(attribute, holder));
 }
 public override bool Process(MethodInfo method, IMethodRemover methodRemover, IFacetHolder holder) {
     var attribute = method.GetCustomAttribute<EagerlyAttribute>();
     return FacetUtils.AddFacet(Create(attribute, holder));
 }