且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET MVC VS Web表单

更新时间:2022-11-06 19:13:15

ASP.NET MVC使用比web表单不同的设计模式。 MVC的目的是分开不同的关切纳入不同的层次。

ASP.NET MVC uses a different design pattern than webforms. MVC aims to separate the different concerns into different layers.

ASP.NET MVC有一些很好的东西出来的箱子你,就像脚手架(基本上你给它的数据源,并为您生成一个基本的形式)和URL重写。你可以,当然,这样做与web表单,但MVC确实开箱对你来说,这是很好的。

ASP.NET MVC has some nice things out of the box for you, like scaffolding (basically you feed it a data source and it generates a basic form for you) and URL rewriting. You can, of course, do this with webforms, but MVC does it out of the box for you, which is nice.

在ASP.NET MVC为您提供了标记的更多的控制(或者至少更容易让你标记的控制)。对于许多人来说,这是一个真正的好到有。这就是说,你也会失去一些使ASP.NET WebForms的易于使用,喜欢的ViewState的事。

In ASP.NET MVC gives you more control of the markup (or at least more easily gives you control of the markup). For many people this is a real nice-to-have. That said, you also lose some of the things that make ASP.NET webforms easy to work with, like ViewState.

另外,我想补充一点,你可以混合和匹配WebForms和MVC的,所以它不是一个全有或全无的局面。

Also, I'd like to add that you can mix and match webforms and MVC, so its not a "all or nothing" situation.

希望这有助于。