asp.net – 为什么我们应该通过部分视图使用MVC 6功能视图组件有什么区别?

MVC 6引入了View组件,并表示它比局部视图更强大和灵活。那是替换部分视图吗?他们之间有什么区别呢?

解决方法

根据这个链接 https://docs.asp.net/en/latest/mvc/views/view-components

New to ASP.NET MVC 6,view components (VCs) are similar to partial views,but they are much more powerful. VCs include the same separation-of-concerns and testability benefits found between a controller and view. You can think of a VC as a mini-controller—it’s responsible for rendering a chunk rather than a whole response.

所以这只是增强部分视图,另一个区别是当您使用部分视图时,仍然依赖于控制器,而在View Component中您不需要控制器。所以有分离的关注。

一个ASP.NET视图组件的详细信息。
http://www.tugberkugurlu.com/archive/exciting-things-about-asp-net-vnext-series-mvc-view-components

相关文章

这篇文章主要讲解了“WPF如何实现带筛选功能的DataGrid”,文...
本篇内容介绍了“基于WPF如何实现3D画廊动画效果”的有关知识...
Some samples are below for ASP.Net web form controls:(fr...
问题描述: 对于未定义为 System.String 的列,唯一有效的值...
最近用到了CalendarExtender,结果不知道为什么发生了错位,...
ASP.NET 2.0 page lifecyle ASP.NET 2.0 event sequence cha...