4

OK, Microsoft removed strongly typed HTML.ActionLink from the main ASP.NET MVC assembly in beta because "of some features that can still evolve in future release of ASP.NET MVC"

But now MVC is officially released, why the strongly typed HTML.ActionLink is still not back?

Community
  • 1
  • 1
Graviton
  • 81,782
  • 146
  • 424
  • 602

4 Answers4

2

here is the answer: http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx

dnord
  • 1,702
  • 2
  • 18
  • 34
Matt Hinze
  • 13,577
  • 3
  • 35
  • 40
1

I believe it got moved in to the futures package.

I think the strongly typed methods are misleading anyway, remember, under the covers it is just a bunch of string maniplulations, after all URLs are just strings!

thatismatt
  • 9,832
  • 10
  • 42
  • 54
  • No... it's not, it's more useful than just mere syntactic purpose. If you need refactoring, you can just the refactoring tool to rename all the instances if you have strongly typed method. But if you are using string-based manipulation then I can only wish you good luck in hunting down every hardcoded string references. – Graviton May 26 '09 at 15:12
  • 1
    I should have been more explicit, I meant under the hood of MVC (not my code!) the strongly typed method converts that information into strings to generate the URL. See the source code on CodePlex, specifically [ExpressionHelper.GetRouteValuesFromExpression](http://aspnet.codeplex.com/SourceControl/changeset/view/23011#266392). – thatismatt May 26 '09 at 15:37
  • 2
    .. and if you read the post in Matt Hinze's answer you will see that the typed nature of the strongly typed ActionLink() skips over more internal MVC you you would prefer. MVC needs to do the 'mapping' of the action name to the method - the strongly typed ActionLink() stops MVC from doing that. – Matt Kocaj May 27 '09 at 05:45
1

Two reasons:

  1. They don't presently support ActionNameAttribute, so they're arguably broken.
  2. There is no caching, so they're presently about 10 times slower than the framework methods.

Also, I agree with matt that we shouldn't pretend that URIs aren't strings.

Craig Stuntz
  • 125,891
  • 12
  • 252
  • 273
0

The link that Matt gave has moved to "http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx". And I agree that "the typed nature of the strongly typed ActionLink() skips over more internal MVC you you would prefer"; but I feel the solution to this isn't to give up on it and use magic strings, but instead to improve ActionLink() to generate a link which takes mappings into account!

Brian Kendig
  • 2,452
  • 2
  • 26
  • 36