ASP.NET CORE – No @HTML.Action….hello ViewComponents !!!

Child actions are removed from ASP.NET Core MVC i.e. there is no @Html.Action ….instead new feature called ViewComponents is introduced.

Concepts is very similar but implementation approach is bit different. To me, major benefit of it is “separation of concerns”.

It can be basically a combination of – HtmlHelper + Child Actions + Separation of Concern + Asynchronous + Dependency Injection

With partial views or child actions, you have dependency on controller.  ViewComponents do not need controller and are implemented separately

Here is a good article if you want to explore more:

https://www.telerik.com/blogs/why-you-should-use-view-components-not-partial-views-aspnet-core

Author: Bhimraj Ghadge

Passionate about everything related Microsoft technologies, particularly ASP.net and SQL server..

Leave a comment