Esempio n. 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);
        }
Esempio n. 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);
 }
Esempio n. 3
0
 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
 {
     return(BeginMethod.GetCustomAttributes(attributeType, inherit));
 }
Esempio n. 4
0
 public override object[] GetCustomAttributes(bool inherit)
 {
     return(BeginMethod.GetCustomAttributes(inherit));
 }