mvc vs asp.net为什么要用mvc [英] mvc vs asp.net why use mvc

查看:97
本文介绍了mvc vs asp.net为什么要用mvc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







目前我使用的是普通的ASP.NET应用程序2.0,它具有三层架构,包括UI,业务层和数据访问层。

我的应用程序是在线酒店预订,包括webservices。

现在我正在考虑将框架更改为4.0。这个MVC对此有用吗?

解决方案

更改框架不是重写应用程序的理由!

4.0,4.5等仍然支持基于ASP.NET Web窗体的应用程序,甚至还增加了一些功能...

所以,我会说 - 不。不要进入不必要的冒险。改变你的平台只是出于原因,而不是因为时尚......


ASP.NET是.NET框架提供的实际Web开发框架。 MVC,Web页面(自ASP.NET 5以后由ASP.NET MVC使用,稍后更新一些)和Web Forms(自ASP.NET 5以来不再包括)只是该框架的衍生物。你错过的是MVC在ASP.NET中也是一个三层架构,它将你的应用程序的代码转换为三层,如:





  1. 模型 - 模型是数据访问层。
  2. 查看 - 视图是应用程序的用户界面。
  3. 控制器 - 主要背面 - 您的申请的最终代码;业务逻辑。





您可以在Model中添加数据访问层的代码,用户界面的代码在Controller部分中的业务逻辑的视图和代码。你会在任何一个框架中发现没有任何区别;但是你将在ASP.NET的MVC框架中获得更多的特性和功能,例如URL Routing,Entity Framework;它也可以在MVC之外工作,还有更多其他功能。



如果你是新手,那么你可以从官方文档 [ ^ ],或者您可以阅读我的文章在ASP.NET MVC上理解ASP.NET MVC框架中的底层概念。



使用真实世界的例子,为初学者和中级人员理解ASP.NET MVC [ ^ ]


检查出来:在7天内逐步学习MVC(模型视图控制器) - 第1天 [ ^ ]

Hi,


Currently I am using normal ASP.NET application 2.0 with three layer architecture which includes UI, Business layer and Data access layer.
My application is online hotel booking which includes webservices.
Now I'm thinking to change framework to 4.0.Is this MVC useful for this?

解决方案

Changing framework is not a reason to rewrite your application!
4.0, 4.5 and so on still support ASP.NET Web Form based applications, even adds a few features...
So, I would say - no. Do not get into a needless adventure. Change your platform only with reasons and not because of fashion...


ASP.NET is the actual web development framework provided by .NET framework. MVC, Web Pages (to be consumed by ASP.NET MVC since ASP.NET 5 a few updates later) and Web Forms (No longer included since ASP.NET 5) are just the derivatives of this framework. What you did miss was that MVC is also a three-layer architecture in ASP.NET, it converts your application's code into three layers as,


  1. Model - model is the data access layer.
  2. View - View is the user-interface of your application.
  3. Controller - The main back-end code for your application; business logic.



You can add the code for your data-access-layer in Model, the code for your user-interface in the Views and the code for your business-logic in the Controller section. There won't be any difference that you will find out in either frameworks; but you will get a lot of more features and functionality in ASP.NET's MVC framework, such as URL Routing, Entity Framework; which can work off-MVC too, and many more such other features.

If you're a newbie, then you can learn ASP.NET MVC from their official documentation[^], or you can read my article on ASP.NET MVC to understand the concept underlying in ASP.NET MVC framework.

Understanding ASP.NET MVC using real world example, for beginners and intermediate[^]


Check this out: Learn MVC (Model View Controller) step by step in 7 days – Day 1[^]


这篇关于mvc vs asp.net为什么要用mvc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆