Once upon a time (back before preview 5 of ASP.NET MVC), you could link to controller actions in a strongly typed manner, like so:
1 |
Go <%= Html.ActionLink<HomeController>(c => c.Index(), "home") %> |
– but due to some design decision, this particular overload is not immediately available anymore.
Fortunately, it has not been deleted from the world – it has just been moved to the Microsoft.Web.Mvc assembly – also known as ASP.NET MVC Beta Futures which is sort of an experimental playground where the MVC team put features that might be implemented as part of the official MVC release.
So, if you realize that your routes are mapped 1:1 directly to your controller methods, then why not reference the aforementioned assembly and add the following to your web.config:
1 2 3 4 5 |
// system.web / compilation / assemblies <add assembly="Microsoft.Web.Mvc"/> // system.web / pages / namespaces <add namespace="Microsoft.Web.Mvc"/> |
– thus bringing back the sweet strongly typed lambda-enabled action link overload.