Strongly Typed ActionLink In Asp.Net MVC 2?

萝らか妹 提交于 2019-11-30 09:01:56

No there is no ActionLink<> see ScottGu blog (( For performance reason.

re: ASP.NET MVC 2: Strongly Typed Html Helpers Tuesday, January 12, 2010 2:32 AM by ScottGu

@Anthony,

but what about strongly typed ActionLinks?

We aren't adding built-in runtime helpers for this - but David Ebbo has created a nice VS tooling add-on that creates strongly-typed helpers you can use: aspnet.codeplex.com/wikipage

Hope this helps,

Scott

Strongly-typed ActionLink and route helpers are not scheduled to be moved from Futures to the main product any time soon. In general it's not possible to run the MVC pipeline backward. That is, given a MethodInfo and parameters, it's impossible to make a route which is guaranteed to hit that action. For example, custom controller factories, action invokers, filters, existing files, or any number of other things can affect which action (if any) a particular route ends up hitting.

Because of this, the contract for strongly-typed ActionLink in Futures is essentially "given this information and assuming no extensibility hooks, guess which route will hit this action." Such a contract is inappropriate for actual supported framework code.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!