Processing Items on Background Thread
Explicit Route Construction in MVC
Instead of using the standard MVC routing approach, I needed full control over route construction. In particular, I need to be able to supply routing names for a group of related scenarios.
routes.MapRoute( name: "BusinessArea", url: "BusinessArea/{businessArea}/{action}", defaults: new { controller = "BusinessArea", action = "Index" }, constraints: new { businessArea = @"\d+" });
Gets replaced with:
private static void ExplicitRouteConstruction(RouteCollection routes) { var defaults = new RouteValueDictionary { { "controller", "BusinessArea" }, { "action", "Index" } }; var constraints = new RouteValueDictionary { { "businessArea", @"\d+" } };</code> var route = new Route( "BusinessArea/{businessArea}/{action}", defaults, constraints, new MvcRouteHandler()); routes.Add("BusinessArea", route); }
Later, I can modify this example to supply the default BusinessArea value.