ASP之间的主要区别是什么?净webforms和MVC

时间:2022-04-08 13:25:58

I know what MVC is and I work in webforms but I don't know how MVC will be that much different. I guess the code behind model will be different. So will it be like webforms minus the code behind and instead having it in a controller?

我知道MVC是什么,我在webforms中工作,但是我不知道MVC会有多大的不同。我想模型后面的代码会不同。那么它会不会像webforms一样减去后面的代码,而把它放在控制器中呢?

I see there are other related posts but I don't they address this.

我看到还有其他相关的文章,但我不知道他们是怎么写的。

5 个解决方案

#1


13  

For starters, MVC does not use the <asp:control> controls, in preference for good old standard <input>'s and the like. Thus, you don't attach "events" to a control that get executed in a code-behind like you would in ASP. It relies on the standard http POST to do that.

对于初学者,MVC不使用 控件,更喜欢好的旧标准 's等。因此,您不会像在ASP中那样将“事件”附加到在代码隐藏中执行的控件。这依赖于标准的http POST。

It does not use the viewstate object.

它不使用viewstate对象。

It allows for more intelligent url mapping, though now that the Routing namespace has been spun off, I wonder if it can be used for WebForms?

它允许更智能的url映射,但是既然路由名称空间已经被派生出来,我想知道它是否可以用于WebForms?

It is much easier to automate testing of web parts.

自动化测试web部件要容易得多。

It allows for much easier separation of UI logic from the "backend" components.

它允许更容易地将UI逻辑与“后端”组件分离。

#2


7  

ASP之间的主要区别是什么?净webforms和MVC

The image says it all.

Update: Adding the original link for completeness. http://forums.asp.net/t/1528396.aspx?MVC+vs+Web+Forms

更新:为完整性添加原始链接。http://forums.asp.net/t/1528396.aspx?MVC +和+网络+形式

#3


2  

The video tutorials here help describe the differences.

这里的视频教程帮助描述这些差异。

#4


2  

There is so much that can be said about your question.

关于你的问题,我们可以谈的太多了。

MVC allows for clean separation of concerns, testability, and test driven development (TDD). It supports clean RESTful URLs and is very extensible... meaning you could swap out of the viewing engine, the routing mechanism, and many other things that you might not like out of the box.

MVC允许分离关注点、可测试性和测试驱动开发(TDD)。它支持干净的RESTful url,并且非常可扩展……这意味着您可以从查看引擎、路由机制和其他许多您可能不喜欢的东西中切换出来。

For additional information I would suggest reading Dino Esposito's blog post entitled An Architectural View of the ASP.NET MVC Framework. Inside this post he compares many differences between the classic code behind approach with MVC.

关于更多的信息,我建议阅读Dino Esposito的博客文章《ASP的架构视图》。净MVC框架。在这篇文章中,他比较了使用MVC的典型代码背后的许多不同之处。

#5


0  

Asp.Net Web Forms:

Asp。Net Web表单:

  1. Asp.Net Web Form follows a traditional event driven development model.
  2. Asp。Net Web表单遵循传统的事件驱动开发模型。
  3. Asp.Net Web Form has server controls.
  4. Asp。Net Web表单具有服务器控件。

Asp.Net MVC model:

Asp。Net MVC模型:

  1. Asp.Net MVC is a lightweight and follow MVC (Model, View, and Controller) pattern based development model.Asp.Net MVC does not support view state.
  2. Asp。Net MVC是一个轻量级的、遵循MVC(模型、视图和控制器)模式的开发模型。Net MVC不支持视图状态。

See more..

看到更多. .

#1


13  

For starters, MVC does not use the <asp:control> controls, in preference for good old standard <input>'s and the like. Thus, you don't attach "events" to a control that get executed in a code-behind like you would in ASP. It relies on the standard http POST to do that.

对于初学者,MVC不使用 控件,更喜欢好的旧标准 's等。因此,您不会像在ASP中那样将“事件”附加到在代码隐藏中执行的控件。这依赖于标准的http POST。

It does not use the viewstate object.

它不使用viewstate对象。

It allows for more intelligent url mapping, though now that the Routing namespace has been spun off, I wonder if it can be used for WebForms?

它允许更智能的url映射,但是既然路由名称空间已经被派生出来,我想知道它是否可以用于WebForms?

It is much easier to automate testing of web parts.

自动化测试web部件要容易得多。

It allows for much easier separation of UI logic from the "backend" components.

它允许更容易地将UI逻辑与“后端”组件分离。

#2


7  

ASP之间的主要区别是什么?净webforms和MVC

The image says it all.

Update: Adding the original link for completeness. http://forums.asp.net/t/1528396.aspx?MVC+vs+Web+Forms

更新:为完整性添加原始链接。http://forums.asp.net/t/1528396.aspx?MVC +和+网络+形式

#3


2  

The video tutorials here help describe the differences.

这里的视频教程帮助描述这些差异。

#4


2  

There is so much that can be said about your question.

关于你的问题,我们可以谈的太多了。

MVC allows for clean separation of concerns, testability, and test driven development (TDD). It supports clean RESTful URLs and is very extensible... meaning you could swap out of the viewing engine, the routing mechanism, and many other things that you might not like out of the box.

MVC允许分离关注点、可测试性和测试驱动开发(TDD)。它支持干净的RESTful url,并且非常可扩展……这意味着您可以从查看引擎、路由机制和其他许多您可能不喜欢的东西中切换出来。

For additional information I would suggest reading Dino Esposito's blog post entitled An Architectural View of the ASP.NET MVC Framework. Inside this post he compares many differences between the classic code behind approach with MVC.

关于更多的信息,我建议阅读Dino Esposito的博客文章《ASP的架构视图》。净MVC框架。在这篇文章中,他比较了使用MVC的典型代码背后的许多不同之处。

#5


0  

Asp.Net Web Forms:

Asp。Net Web表单:

  1. Asp.Net Web Form follows a traditional event driven development model.
  2. Asp。Net Web表单遵循传统的事件驱动开发模型。
  3. Asp.Net Web Form has server controls.
  4. Asp。Net Web表单具有服务器控件。

Asp.Net MVC model:

Asp。Net MVC模型:

  1. Asp.Net MVC is a lightweight and follow MVC (Model, View, and Controller) pattern based development model.Asp.Net MVC does not support view state.
  2. Asp。Net MVC是一个轻量级的、遵循MVC(模型、视图和控制器)模式的开发模型。Net MVC不支持视图状态。

See more..

看到更多. .