示例#1
0
        public override FilterInfo GetFilters()
        {
            // For simplicity, we only consider filters on BeginFoo() since it is the entry point to the action

            // Enumerable.OrderBy() is a stable sort, so this method preserves scope ordering.
            FilterAttribute[]      typeFilters    = (FilterAttribute[])BeginMethod.ReflectedType.GetCustomAttributes(typeof(FilterAttribute), true /* inherit */);
            FilterAttribute[]      methodFilters  = (FilterAttribute[])BeginMethod.GetCustomAttributes(typeof(FilterAttribute), true /* inherit */);
            List <FilterAttribute> orderedFilters = typeFilters.Concat(methodFilters).OrderBy(attr => attr.Order).ToList();

            FilterInfo filterInfo = new FilterInfo();

            MergeFiltersIntoList(orderedFilters, filterInfo.ActionFilters);
            MergeFiltersIntoList(orderedFilters, filterInfo.AuthorizationFilters);
            MergeFiltersIntoList(orderedFilters, filterInfo.ExceptionFilters);
            MergeFiltersIntoList(orderedFilters, filterInfo.ResultFilters);
            return(filterInfo);
        }
示例#2
0
 public override ICollection <ActionSelector> GetSelectors()
 {
     ActionMethodSelectorAttribute[] attrs = (ActionMethodSelectorAttribute[])BeginMethod.GetCustomAttributes(typeof(ActionMethodSelectorAttribute), true /* inherit */);
     ActionSelector[] selectors            = Array.ConvertAll(attrs, attr => (ActionSelector)(controllerContext => attr.IsValidForRequest(controllerContext, BeginMethod)));
     return(selectors);
 }
示例#3
0
 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
 {
     return(BeginMethod.GetCustomAttributes(attributeType, inherit));
 }
示例#4
0
 public override object[] GetCustomAttributes(bool inherit)
 {
     return(BeginMethod.GetCustomAttributes(inherit));
 }