Where to call RouteDebugger.RewriteRoutesForTesting() when route registration is injected?
Posted
by boris callens
on Stack Overflow
See other posts from Stack Overflow
or by boris callens
Published on 2010-04-04T19:49:41Z
Indexed on
2010/04/04
19:53 UTC
Read the original article
Hit count: 582
As Phil Haack explains on his blog entry, the Route Debugger helps visualizing your routing tables.
My site however gets it's routing injected by the MVCTurbine dependency injection (using Unity) like so:
public class DefaultRoutRegistration : IRouteRegistrator
{
public void Register(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Accounts",
"Accounts/{userName}/{action}",
new { controller = "Account", action = "Index" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
}
}
Where exactly can I throw in the the RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); to rewrite my routing table?
© Stack Overflow or respective owner