MVC2、MVC3、MVC4、MVC5之间的区别 以及Entity Framework 6 Code First using MVC 5官方介绍教程
现在MVC的技术日趋成熟,面对着不同版本的MVC大家不免有所迷惑 -- 它们之间有什么不同呢?下面我把我搜集的信息汇总一下,以便大家能更好的认识不同版本MVC的功能,也便于自己查阅。
View Engine :
View Engine is responsible for rendering of the HTML code from your views to the browser.
MVC 2 uses only Web Forms view engine (.aspx) as a default View Engine.
MVC3 uses Razor View Engine (.cshtml for c# and .vbhtml for Visual Basic) and Web Forms view engine (.aspx).
MVC4 also uses Razor View Engine as a default view engine with some new features like condition attribute and ‘Tilde slash’.
Chart, WebGrid, Crypto,WebImage, WebMail Controls :
All these are not available in MVC2.
All these are available in MVC3 and in MVC4.
Syntex :
(HTML Syntax) Web Forms view engine syntax: <%=Html code %> in MVC2.
(Razor Syntax) Razor View Engine syntax: @Html code in MVC3.
MVC4 has the same Razor View Engine Syntax but with the addition of new features like conditional attribute and ‘Tilde Slash’ i.e. URL resolution.
Objects available for sharing of data between View and Controller :
TempData, ViewData are available in MVC2.
TempData, ViewData ,ViewBag are available in MVC3.
TempData, ViewData ,ViewBag are available in MVC4.
> TempData is used with current and subsequent request i.e. when you know the next view to be redirected.
> In ViewData, dictionary of objects are accessible via strings as keys.
> ViewBag was added in the C# 4.0 which uses the dynamic feature that allows to add properties of an object dynamically . We can say that ViewBag = ViewData + dynamic feature around the ViewData dictionary.
Jquery Support :
Jquery support is Good in MVC2.
Jquery support is Better in MVC3.
MVC4 provides better support for Jquery like Jquery Mobile.
Dependency Injection Support :
Dependency injection is Good in MVC2.
It provides powerful hooks with Dependency Injection and Global Action Filters in MVC3.
Better support in MVC4.
View Engine :
View Engine is responsible for rendering of the HTML code from your views to the browser.
MVC 2 uses only Web Forms view engine (.aspx) as a default View Engine.
MVC3 uses Razor View Engine (.cshtml for c# and .vbhtml for Visual Basic) and Web Forms view engine (.aspx).
MVC4 also uses Razor View Engine as a default view engine with some new features like condition attribute and ‘Tilde slash’.
Chart, WebGrid, Crypto,WebImage, WebMail Controls :
All these are not available in MVC2.
All these are available in MVC3 and in MVC4.
Syntex :
(HTML Syntax) Web Forms view engine syntax: <%=Html code %> in MVC2.
(Razor Syntax) Razor View Engine syntax: @Html code in MVC3.
MVC4 has the same Razor View Engine Syntax but with the addition of new features like conditional attribute and ‘Tilde Slash’ i.e. URL resolution.
Objects available for sharing of data between View and Controller :
TempData, ViewData are available in MVC2.
TempData, ViewData ,ViewBag are available in MVC3.
TempData, ViewData ,ViewBag are available in MVC4.
> TempData is used with current and subsequent request i.e. when you know the next view to be redirected.
> In ViewData, dictionary of objects are accessible via strings as keys.
> ViewBag was added in the C# 4.0 which uses the dynamic feature that allows to add properties of an object dynamically . We can say that ViewBag = ViewData + dynamic feature around the ViewData dictionary.
Jquery Support :
Jquery support is Good in MVC2.
Jquery support is Better in MVC3.
MVC4 provides better support for Jquery like Jquery Mobile.
Dependency Injection Support :
Dependency injection is Good in MVC2.
It provides powerful hooks with Dependency Injection and Global Action Filters in MVC3.
Better support in MVC4.
Layout Support :
Supports only Master Page in MVC2.
Supports not only Master Page but also Layout Page in MVC 3 and in MVC4.
Validation :
Client-side Validation and Asynchronous controllers is there in MVC2.
Unobtrusive Ajax and Client side Validation, Jquery Validation and JSON binding support is in MVC3.
Client side validation, Jquery validation and enhanced support for asynchronous methods in MVC4.
Project Templates :
MVC3 supports project templates enabled by HTML 5.
MVC4 supports many new features for mobile apps and also provides new mobile project template and default templates are refreshed and modernized.
New features in asp.net mvc 5:
1. One ASP.NET
2. Asp.Net Identity
3. Bootstrap in the MVC template
4. Authentication Filters
5. Filter overrides
You can get the more details from Microsoft MSDN http://www.asp.net/visual-studio/overview/2013/release-notes#TOC10
Layout Support :
Supports only Master Page in MVC2.
Supports not only Master Page but also Layout Page in MVC 3 and in MVC4.
Validation :
Client-side Validation and Asynchronous controllers is there in MVC2.
Unobtrusive Ajax and Client side Validation, Jquery Validation and JSON binding support is in MVC3.
Client side validation, Jquery validation and enhanced support for asynchronous methods in MVC4.
Project Templates :
MVC3 supports project templates enabled by HTML 5.
MVC4 supports many new features for mobile apps and also provides new mobile project template and default templates are refreshed and modernized.
New features in asp.net mvc 5:
1. One ASP.NET
2. Asp.Net Identity
3. Bootstrap in the MVC template
4. Authentication Filters
5. Filter overrides
You can get the more details from Microsoft MSDN http://www.asp.net/visual-studio/overview/2013/release-notes#TOC10
文章引自:http://bubuko.com/infodetail_40420.html
MVC5详细介绍教程Getting Started with Entity Framework 6 Code First using MVC 5(英文):http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application
MVC2、MVC3、MVC4、MVC5之间的区别 以及Entity Framework 6 Code First using MVC 5官方介绍教程的更多相关文章
- MVC2 ,MVC3 ,MVC4,MVC5的区别,EF的各个版本的区别;LocalDB是个啥
2010年發行ASP.NET MVC 2.0版,2011年發行ASP.NET MVC 3.0版,2012年發行ASP.NET MVC 4.0版 MVC3 需要.net framework 4.0 版本 ...
- MVC2,MVC3,MVC4和MVC5的不同
现在MVC的技术日趋成熟,面对着不同版本的MVC大家不免有所迷惑 -- 它们之间有什么不同呢?下面我把我搜集的信息汇总一下,以便大家能更好的认识不同版本MVC的功能,也便于自己查阅. View Eng ...
- Entity Framework 6 Code First +MVC5+MySql/Oracle使用过程中的几个问题
1. namespace Snapsia.Web.Models { using System; using System.Data.Entity; using System.ComponentMode ...
- 《ASP.NET MVC4 WEB编程》学习笔记------Entity Framework的Database First、Model First和Code Only三种开发模式
作者:张博出处:http://yilin.cnblogs.com Entity Framework支持Database First.Model First和Code Only三种开发模式,各模式的开发 ...
- asp.net mvc5 step by step(三)—— Entity Framework Database First
一.先建数据库. 打开,SQL Server Management 新建数据库Employee 并新建表 /****** Object: Table [dbo].[t_Employee] Script ...
- 使用MVC5的Entity Framework 6入门 ---- 系列教程
使用MVC5的Entity Framework 6入门(十二)——为ASP.NET MVC应用程序使用高级功能 为ASP.NET MVC应用程序使用高级功能这是微软官方教程Getting Starte ...
- Jquery中.bind()、.live()、.delegate()和.on()之间的区别详解
简介 最近了解到很多网页开发者对jquery中的 .bind() .live() .delegate() 和 .on() 方法存在很多的疑惑.这些疑惑通常是关于它们之间真正的区别是什么啊,什么时候该使 ...
- MVC5 Entity Framework学习之Entity Framework高级功能(转)
在之前的文章中,你已经学习了如何实现每个层次结构一个表继承.本节中你将学习使用Entity Framework Code First来开发ASP.NET web应用程序时可以利用的高级功能. 在本节中 ...
- MVC5 Entity Framework学习之Entity Framework高级功能
在之前的文章中,你已经学习了怎样实现每一个层次结构一个表继承. 本节中你将学习使用Entity Framework Code First来开发ASP.NET web应用程序时能够利用的高级功能. 在本 ...
随机推荐
- DB other operation
A prepared statement is a feature used to execute the same/similar SQL statement repeatedlly with hi ...
- Java 集合深入理解(10):Deque 双端队列
点击查看 Java 集合框架深入理解 系列, - ( ゜- ゜)つロ 乾杯~ 什么是 Deque Deque 是 Double ended queue (双端队列) 的缩写,读音和 deck 一样,蛋 ...
- mysql联合索引详解
联合索引又叫复合索引.对于复合索引:Mysql从左到右的使用索引中的字段,一个查询可以只使用索 引中的一部份,但只能是最左侧部分.例如索引是key index (a,b,c). 可以支持a | a,b ...
- HDU 3038
http://acm.hdu.edu.cn/showproblem.php?pid=3038 题意:[1-n]的区间,有m个询问,每个询问表示[a,b]的和是s,问一共有多少组矛盾 sum[i]表示i ...
- 全面认识.NET框架(一)
重新学习下.NET框架,在这里将会对.net框架逐步的学.加深一下对.net的认识.如果那个地方有错误,希望大家能够指出来.谢谢. 知识有限,先逐步了解下.net包含的什么.我就是写写我目前想了解的内 ...
- M2: XAML Controls
本小节介绍如何在界面上添加简单的XAML Controls, 本例中我们用到了Grid, TextBlock, Button, 和StackPanel控件.XAML自身所有的控件都声明在Windows ...
- JavaScript中指针和地址理解
个人理解:指针只是指向内存的一个索引:而地址则是内存中确切的位置. 下面是函数中关于指针和地址一个小例子: function sum(num1,num2){ return num1+num2; } a ...
- PAT (Basic Level) Practise:1008. 数组元素循环右移问题
[题目连接] 一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A0A1……AN-1)变换为(AN-M …… A ...
- ZOJ 1005 Jugs
原题链接 题目大意:有一大一小两个杯子,相互倒水,直到其中一个杯子里剩下特定体积的水.描述这个过程. 解法:因为两个杯子的容积互质,所以只要用小杯子不断往大杯子倒水,大杯子灌满后就清空,大杯子里迟早会 ...
- 使用move_base导航 ---13
摘要: 原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/ 我们现在准备用move_base简单的移动机器人记住,一个“pose”在ros的意思是一个位置和 ...