开发者

Where to call RouteDebugger.RewriteRoutesForTesting() when route registration is injected?

开发者 https://www.devze.com 2022-12-25 09:30 出处:网络
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) lik

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 = "Acc开发者_StackOverflow中文版ount", 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?


Sorry Boris, but I don't notified when a question is asked on StackOverflow for the turbine tag. :(

Yes, that's the correct place for putting the RouteDebug piece.

0

精彩评论

暂无评论...
验证码 换一张
取 消