开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜