2
votes

I am currently using the standard routing config and T4MVC for my ActionLinks like so:

routes.MapRoute("Default",
                "{controller}/{action}",
                new { controller = "Home", action = "Index", id = "" },
                new[] { "HM.Web.Controllers.Home" }
                );

@Html.ActionLink("Login", MVC.Login.Index())

But now I would like to move to attribute routing in MVC 5, from initial tests it doesn't look as if T4MVC will pickup my attribute routes and falls back to using the default route.

Is there a way to get T4MVC to work with attribute routing? and if not is there an alternative to get strongly typed action link?

1

1 Answers

0
votes

This should work. The first thing you should check is that you are getting the right link if you don't use T4MVC. This will make sure that you have everything set up correctly, like calling MapMvcAttributeRoutes in the correct place (which can be tricky for areas).

If that works without T4MVC, but the equivalent T4MVC call doesn't, then we have a strange situation to investigate, but let's wait till we get there.