代码改变世界

Entity Framework Tutorial Basics(31):Migration from EF 4.X

2016-07-07 10:38  追忆似水流年  阅读(157)  评论(0编辑  收藏  举报

Migration from Entity Framework 4.1/4.3 to Entity Framework 5.0/6.0

To migrate your existing Entity Framework 4.x project to Entity Framework 5.0 using VS2012, first target .NET Framework 4.5:

Entity Framework Tutorial

Second, remove the existing Entity Framework 4.1/4.3 reference and install Entity Framework 5.0 from NuGet:

Entity Framework Tutorial

Search for Entity Framework online and install it. Make sure that the version is 5.0:

Entity Framework Tutorial

If you check the version of the Entity Framework reference, then it should be 5.0.0.0:

Entity Framework Tutorial

If you open your existing data model (.edmx) file then it may give an error, as it is still using EDMX version 2.0 (open edmx as XML). Click on the 'Modify' link on the designer and it will be modified to version 3.0.

Now your existing Entity Framework project will work in Entity Framework 5.0 without any major changes.