Introduce strongly-typed HtmlHelper / UrlHelper methods
We should be able to use strongly-typed HtmlHelper (and UrlHelper) methods as follows: Html.Action<ProductsController>(pc => pc.Index())
I'm just starting with MVC and really shocked this is not available. Strong typing should surely be a must for a .NET based framework? How have people been using this in the real world, doesn't everyone's code break with minor refactoring?
Miguel Angelo Santos Bicudo commented
This is a good idea, but have a lot of caveats. Expression trees have problems with calling methods inside the lambda expressions with optional parameters. Also, when using view models, it gets a little more complicated, because you wouldn't be abled to choose which properties to use when creating an url with Url. I really don't see this feature as worth as the effort required to do it, givend the limitations... what I would ask, and Resharper already does, is validate the strings used as action names, but it does not help with parameters. Some ideal tool, would help with everything, the area, the action and controller names, and also with the parameters.
Peter Šulek commented
To Huske: MVC Future is fine and i use it a lot, but it would be nice in next mvc(5?) to have strong typed HtmlHelper/UrlHelper!
Marius, this is already available in MVC Futures. Just like you, I was really keen for this idea and used it a lot until I realized that applying ActionName attribute spoils the fun.