@Html.Action in Asp.Net Core

后端 未结 9 2097
说谎
说谎 2020-11-27 19:25

Where is @Html.Action in Asp.net Core? I can see @Html.ActionLink but not a direct call to an Action as before.

Was it replaced by ViewComp

9条回答
  •  渐次进展
    2020-11-27 19:50

    Yes, ViewComponents would be the new way of doing this, but they are not exactly the same as what @Html.Action was doing before though...for example, in MVC5 and prior, invoking 'child actions' would also execute any filters (for example, if the controller had filters decorated on them) giving them the appearance as regular actions...but this is not true with ViewComponents and they are executed in the context of actual request...

    More info on view components: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-components

提交回复
热议问题