public FilterInfo GetFilters(FilterRegistryContext context) { FilterInfo filters = new FilterInfo(); foreach (FilterRegistryItem item in items) { if (item.Match(context)) { object filterObject = container.Resolve(item.FilterType); if (filterObject is IActionFilter) { filters.ActionFilters.Add((IActionFilter)filterObject); } if (filterObject is IAuthorizationFilter) { filters.AuthorizationFilters.Add((IAuthorizationFilter)filterObject); } if (filterObject is IExceptionFilter) { filters.ExceptionFilters.Add((IExceptionFilter)filterObject); } if (filterObject is IResultFilter) { filters.ResultFilters.Add((IResultFilter)filterObject); } } } return(filters); }
public bool Match(FilterRegistryContext context) { ReflectedActionDescriptor reflectedDescriptor = context.ActionDescriptor as ReflectedActionDescriptor; if (reflectedDescriptor != null) { return(methods.Any(a => a.MethodInfo == reflectedDescriptor.MethodInfo)); } return(methods.Any(a => a.ControllerDescriptor.FindAction(context.ControllerContext, context.ActionDescriptor.ActionName) != null)); }
public bool Match(FilterRegistryContext context) { return(filterCriteria.Aggregate(true, (prev, f) => prev ? f.Match(context) : prev)); }
public bool Match(FilterRegistryContext context) { return(string.Equals(format, context.ControllerContext.RouteData.Values["dataFormat"] as string, StringComparison.OrdinalIgnoreCase)); }