internal AsyncInvocationWithFilters( AsyncControllerActionInvoker invoker, ControllerContext controllerContext, ActionDescriptor actionDescriptor, IList <IActionFilter> filters, IDictionary <string, object> parameters, AsyncCallback asyncCallback, object asyncState ) { Contract.Assert(invoker != null); Contract.Assert(controllerContext != null); Contract.Assert(actionDescriptor != null); Contract.Assert(filters != null); Contract.Assert(parameters != null); _invoker = invoker; _controllerContext = controllerContext; _actionDescriptor = actionDescriptor; _filters = filters; _parameters = parameters; _asyncCallback = asyncCallback; _asyncState = asyncState; _preContext = new ActionExecutingContext( controllerContext, actionDescriptor, parameters ); // For IList<T> it is faster to cache the count _filterCount = _filters.Count; }
internal ActionInvocation(AsyncControllerActionInvoker invoker, ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary <string, object> parameters) { Contract.Assert(invoker != null); Contract.Assert(controllerContext != null); Contract.Assert(actionDescriptor != null); Contract.Assert(parameters != null); _invoker = invoker; _controllerContext = controllerContext; _actionDescriptor = actionDescriptor; _parameters = parameters; }
internal List<RouteEntry> MapMvcAttributeRoutes(IEnumerable<Type> controllerTypes) { ControllerDescriptorCache descriptorsCache = new AsyncControllerActionInvoker().DescriptorCache; IEnumerable<ReflectedAsyncControllerDescriptor> descriptors = controllerTypes .Select( type => descriptorsCache.GetDescriptor(type, innerType => new ReflectedAsyncControllerDescriptor(innerType), type)) .Cast<ReflectedAsyncControllerDescriptor>(); List<RouteEntry> routeEntries = new List<RouteEntry>(); foreach (ReflectedAsyncControllerDescriptor controllerDescriptor in descriptors) { routeEntries.AddRange(MapMvcAttributeRoutes(controllerDescriptor)); } routeEntries.Sort(); return routeEntries; }
internal AsyncInvocationWithFilters(AsyncControllerActionInvoker invoker, ControllerContext controllerContext, ActionDescriptor actionDescriptor, IList<IActionFilter> filters, IDictionary<string, object> parameters, AsyncCallback asyncCallback, object asyncState) { Contract.Assert(invoker != null); Contract.Assert(controllerContext != null); Contract.Assert(actionDescriptor != null); Contract.Assert(filters != null); Contract.Assert(parameters != null); _invoker = invoker; _controllerContext = controllerContext; _actionDescriptor = actionDescriptor; _filters = filters; _parameters = parameters; _asyncCallback = asyncCallback; _asyncState = asyncState; _preContext = new ActionExecutingContext(controllerContext, actionDescriptor, parameters); // For IList<T> it is faster to cache the count _filterCount = _filters.Count; }
internal ActionInvocation(AsyncControllerActionInvoker invoker, ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary<string, object> parameters) { Contract.Assert(invoker != null); Contract.Assert(controllerContext != null); Contract.Assert(actionDescriptor != null); Contract.Assert(parameters != null); _invoker = invoker; _controllerContext = controllerContext; _actionDescriptor = actionDescriptor; _parameters = parameters; }
internal static void AddRouteEntries(SubRouteCollection collector, IEnumerable<Type> controllerTypes, IInlineConstraintResolver constraintResolver) { ControllerDescriptorCache descriptorsCache = new AsyncControllerActionInvoker().DescriptorCache; IEnumerable<ReflectedAsyncControllerDescriptor> descriptors = controllerTypes .Select( type => descriptorsCache.GetDescriptor(type, innerType => new ReflectedAsyncControllerDescriptor(innerType), type)) .Cast<ReflectedAsyncControllerDescriptor>(); foreach (ReflectedAsyncControllerDescriptor controllerDescriptor in descriptors) { AddRouteEntries(collector, controllerDescriptor, constraintResolver); } }
private static IEnumerable<ReflectedAsyncControllerDescriptor> GetControllerDescriptors(IEnumerable<Type> controllerTypes) { Contract.Assert(controllerTypes != null); Func<Type, ControllerDescriptor> descriptorFactory = ReflectedAsyncControllerDescriptor.DefaultDescriptorFactory; ControllerDescriptorCache descriptorsCache = new AsyncControllerActionInvoker().DescriptorCache; return controllerTypes .Select(type => descriptorsCache.GetDescriptor(type, descriptorFactory, type)) .Cast<ReflectedAsyncControllerDescriptor>(); }