views:

776

answers:

1

Moved from preview 2 to preview 5 and now my Html.ActionLink calls are all failing. It appears that the generic version has been replaced with a non-type safe version.

// used to work
<li>
  <%= Html.ActionLink<HomeController>(c => c.Index(), "Home")%>
</li>
// what appears I can only do now
<li>
  <%= Html.ActionLink<HomeController>("Index", "Home")%>
</li>

Why did The Gu do this? Has it been moved to Microsoft.Web.Mvc or somewhere else as a "future"? Is there a replacement that is generic? Halp!

+6  A: 

Don't blame the GU, it's my fault. That method has been moved to MvcFutures. Here's a blog post that provides the foundation for why this change was made.

Haacked
Aaaw, come on. As if you can't check the method being called in the Expression to see if it has the ActionNameAttribute on it.
Will
Nope, because that attribute could be applied dynamically and not directly on the method.
Haacked
Not to metnion, that there are other extensibility points that could change the action name after method selection.
Haacked
Would it not be possible to have an "action interface" similar to an interface that would define the actions available in an interfacey manner which could then be used to have a type safe way of accessing the actions. Then at start up the concerete controller could be assigned to be the implementation of the interface so you could have the flexibility you describe that a method is not necessarily an action but still have the ability to use type-safe ActionLinks and RenderActions. VS or Resharper could then warn you (not error) if the action interface is not implemented.
Stu