I suggest you ...

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())

342 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Marius SchulzMarius Schulz shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Miguel Angelo Santos BicudoMiguel Angelo Santos Bicudo commented  ·   ·  Flag as inappropriate

        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 ŠulekPeter Šulek commented  ·   ·  Flag as inappropriate

        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!

      • HuskeHuske commented  ·   ·  Flag as inappropriate

        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.

      Feedback and Knowledge Base