/// <summary> /// Maps the attribute-defined routes for the application. /// </summary> /// <param name="routes">The route collection.</param> /// <param name="constraintResolver"> /// The <see cref="IInlineConstraintResolver"/> to use for resolving inline constraints in route templates. /// </param> /// <param name="directRouteProvider"> /// The <see cref="IDirectRouteProvider"/> to use for mapping routes from controller types. /// </param> public static void MapAttributeRoutes( RouteCollection routes, IInlineConstraintResolver constraintResolver, IDirectRouteProvider directRouteProvider ) { if (routes == null) { throw new ArgumentNullException("routes"); } if (constraintResolver == null) { throw new ArgumentNullException("constraintResolver"); } if (directRouteProvider == null) { throw new ArgumentNullException("directRouteProvider"); } DefaultControllerFactory typesLocator = DependencyResolver.Current.GetService <IControllerFactory>() as DefaultControllerFactory ?? ControllerBuilder.Current.GetControllerFactory() as DefaultControllerFactory ?? new DefaultControllerFactory(); IReadOnlyList <Type> controllerTypes = typesLocator.GetControllerTypes(); MapAttributeRoutes(routes, controllerTypes, constraintResolver, directRouteProvider); }