简体   繁体   English

asp.net mvc应用程序和asp.net Web应用程序之间有什么区别

[英]what is the difference between the asp.net mvc application and asp.net web application

can any one explain the difference between the mvc and web application in asp.net. 任何人都可以解释asp.net中mvc和web应用程序之间的区别。 in mvc we can find controllers folder. 在mvc中我们可以找到controllers文件夹。 cant we able to find controllers folder in web application..! 我们无法在Web应用程序中找到控制器文件夹..! please vanish my confusion. 请消除我的困惑。

MVC uses controllers to orchestrate the models and views to provide user interfaces to the user. MVC使用控制器来协调模型和视图,以向用户提供用户界面。

Web forms doesn't use controllers to achieve this, it uses code behind with events. Web表单不使用控制器来实现这一点,它使用事件背后的代码。

MVC is built around the notion of separation of concerns - each thing is responsible for its own bit, and shouldn't be concerned with what other bits are doing. MVC是围绕关注点分离的概念构建的 - 每个事物都由它自己的位负责,而不应该关注其他位正在做什么。 Webforms has them a bit more mushed together, where code sits associated 1:1 with the webform (in the code behind), often leading to business logic creeping into the UI. Webforms将它们混合在一起,其中代码与webform(在后面的代码中)1:1相关联,通常导致业务逻辑蔓延到UI。

WebForms uses a powerful eventing system to help abstract away some of the complexities of HTTP, such as its stateless nature. WebForms使用强大的事件系统来帮助抽象出一些HTTP的复杂性,例如其无状态特性。 MVC doesn't do this, which requires the developer to work within the confines of a pure HTTP environment. MVC不这样做,这要求开发人员在纯HTTP环境的范围内工作。 The eventing system in WebForms lets you quickly wire up events in a familiar way if you've come from a VB6/WinForms background (which the target audience had when ASP.NET was first released). WebForms中的事件系统允许您以熟悉的方式快速连接事件,如果您来自VB6 / WinForms背景(目标受众在ASP.NET首次发布时具有此背景)。

Have a look at http://www.asp.net/mvc which has a lot of great tutorials on getting started with MVC. 看看http://www.asp.net/mvc ,它有许多关于MVC入门的很棒的教程。

An ASP.NET MVC application is an application which depends upon the ASP.NET MVC Framework. ASP.NET MVC应用程序是一个依赖于ASP.NET MVC框架的应用程序。 MVC stands for Model, View Controller, the three components which define an application created using the MVC pattern. MVC代表Model,View Controller,它定义了使用MVC模式创建的应用程序的三个组件。

The MVC pattern aims to seperate an applications logic, data and presentation into distinct, somewhat independent components. MVC模式旨在将应用程序逻辑,数据和表示分离成不同的,有些独立的组件。

Model 模型

Models are a representation of an application's data. 模型是应用程序数据的表示。 For example a shopping application might have a Cart model to represent the state of a user's shopping cart. 例如,购物应用程序可能具有用于表示用户购物车状态的购物车模型。

View 视图

A view is a visual representation of the data contained in the model. 视图是模型中包含的数据的直观表示。 A view class should knoow the specifics of how the model(s) it uses should be presented. 视图类应该知道应该如何呈现它使用的模型的细节。

Controller 调节器

The Controller's job is to handle user input and update the state of the Model to reflect the changes that were made as a result of user action. Controller的工作是处理用户输入并更新模型的状态以反映由于用户操作而发生的更改。 For example imagine the user is viewing a Contact Us page and clicks the Submit button. 例如,假设用户正在查看“联系我们”页面并单击“提交”按钮。 The controller would respond to the button click by updating the model with values from the form fields and then save the model, causing it to be validated and then written to the database. 控制器将通过使用表单字段中的值更新模型来响应按钮单击,然后保存模型,使其得到验证,然后写入数据库。

This is a very shallow and incomplete explaination of the MVC pattern you should head over to the ASP.NET MVC homepage to get a more complete view of the MVC pattern and the ASP.NET MVC framework. 这是对MVC模式的一个非常浅薄和不完整的解释,您应该转到ASP.NET MVC主页,以获得更完整的MVC模式和ASP.NET MVC框架视图。

An ASP.NET Web Application uses a separate framework known as Web Forms. ASP.NET Web应用程序使用称为Web窗体的单独框架。 Because Web Forms does not use the conventions defined in the MVC pattern, the Web Application template does not create a similar folder structure . 由于Web窗体不使用MVC模式中定义的约定,因此Web应用程序模板不会创建类似的文件夹结构。

The use of either framework is not mutually exclusive, the two represent differing approaches to the same problem. 这两种框架的使用并不相互排斥,两者代表了对同一问题的不同方法。 With respect to which is most efficient for data access I would refere you to Michael Shimmins' excellent comment 关于哪种方式对数据访问最有效,我会引用Michael Shimmins的优秀评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 这两个项目有什么区别,ASP.NET MVC2 Web应用程序和ASP.NET MVC2 Empty Web应用程序? - what is the difference between these two projects, ASP.NET MVC2 web application and ASP.NET MVC2 Empty Web application? What is the difference between ASP.NET Web Forms vs ASP.NET WebSite vs ASP.NET Web Application vs ASP.NET MVC? - What is the difference between ASP.NET Web Forms vs ASP.NET WebSite vs ASP.NET Web Application vs ASP.NET MVC? ASP.NET 和 ASP.NET MVC 有什么区别? - What is the difference between ASP.NET and ASP.NET MVC? ASP.NET MVC中<%:和<%=有什么区别? - What is the difference between <%: and <%= in ASP.NET MVC? 使用 ASP.NET MVC web 应用程序 - Using ASP.NET MVC web application ASP.NET中的Application和Cache有什么区别? - What is the difference between Application and Cache in ASP.NET? 在Asp.net或Asp.net mvc中使用哪些工具设计Web应用程序? - What tools you use to design web application in Asp.net or Asp.net mvc? asp.net 内核和 asp.net 内核 mvc 应用程序之间的主要区别是什么? - What are the major differences between asp.net core and asp.net core mvc application? .Net桌面应用程序和ASP.NET Web应用程序之间的通信 - Communication between .Net Desktop Application and ASP.NET Web application asp.net Web应用程序 - asp.net web application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM