public FilterInfo GetFilters(ActionFilterRegistryContext context) { FilterInfo filters = new FilterInfo(); foreach (ActionFilterRecord record in registry) { if (record.Match(context)) { object filterObject = container.Resolve(record.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(ActionFilterRegistryContext 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(ActionFilterRegistryContext context) { return(criteria.Aggregate(true, (prev, f) => prev ? f.Match(context) : prev)); }