数据库第一代实体框架5 System.Data.Entity vs EntityFramework [英] Database first generation Entity Framework 5 System.Data.Entity vs EntityFramework

查看:103
本文介绍了数据库第一代实体框架5 System.Data.Entity vs EntityFramework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Visual Studio 2012,Entity Framework 5.0数据库的第一种方法来生成我的edmx。



当从数据库VS 2012生成EDMX时 - 说


成功注册了程序集System.Data.Entity,Version = 4.0.0.0;


web.config 文件以及

 < add assembly =System.Data.Entity,Version = 4.0.0.0 ,文化=中立... /> 




  1. 我请参阅引用中列出的 EntityFramework System.Data.Entity EntityFramework 显示在包文件夹中, System.Data.Entity 指向.NET 4.5安装文件夹,这是否意味着我成功使用EF 5.0? / p>


  2. 对于现有项目迁移 - 当我从VS 2010 .NET 4.0迁移项目并将.NET客户端配置文件设置为4.5时,系统.Data.Entity 程序集升级到.NET 4.5安装文件夹中的一个。我没有看到 EntityFramework.dll 。是否有任何改变,我需要为了我现有的项目,以维持到EF 5.0和.NET 4.5


我在这里缺少一些东西?

解决方案

在.NET上,System.Data.Entity.dll程序集的版本是一样的框架4和.NET Framework 4.5。捕获的是,只能在一台机器上同时安装一个版本,即使您在项目中定位了.NET Framework 4,但是在具有.NET Framework 4.5的机器上运行应用程序,您将有效地运行.NET Framework 4.5(因此是System.Data.Entity.dll程序集的EF5版本)。
关于EntityFramework.dll - 直到版本6它是构建在System.Data.Entity.dll之上(在EF6中,System.Data.Entity.dll和EntityFramework.dll的代码已合并并进一步进化)。如果您在VS2010中使用EntityFramework.dll,则意味着它必须是EF4之一的4.x版本之一。即使使用EF5版本的System.Data.Entity.dll也可以继续使用它,但是您将无法充分利用EF5中引入的新功能(如枚举,空间等)。由于您决定移植到.NET Framework 4.5 / EF5,您还应该更新EntityFramework.dll 5.0.0.0。为此,您必须安装NuGet扩展( http://docs.nuget。 org / docs / start-here / installation-nuget )如果你还没有,只需使用包管理器控制台安装EntityFramework.dll( http://www.nuget.org/packages/EntityFramework/5.0.0 )。它应该用5.0。


替换您项目中的4.x版本

Trying to use Visual Studio 2012, Entity Framework 5.0 database first approach to generate my edmx.

When I generate the EDMX from the database VS 2012 - says

Successfully registered the assembly 'System.Data.Entity, Version=4.0.0.0;

web.config file as well says

<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral.../>

  1. I see EntityFramework and System.Data.Entity both listed in the references. EntityFramework shows up in the packages folder and System.Data.Entity points to the .NET 4.5 install folder. Does this mean that I am succesfully using EF 5.0?

  2. For existing project migrations - when I migrate a project from VS 2010 .NET 4.0 and set the .NET client profile to 4.5 the System.Data.Entity assembly gets upgraded to the one in .NET 4.5 install folder. I do not see the EntityFramework.dll at all. Are there any changes I would need to make in order for my existing project to mgirate to EF 5.0 and .NET 4.5

Am I missing something here?

解决方案

The version of System.Data.Entity.dll assembly is the same on both .NET Framework 4 and .NET Framework 4.5. The catch is that only one version can be installed on a machine at the same time so even if you target .NET Framework 4 in your project but run your app on a machine with .NET Framework 4.5 you will effectively run it against .NET Framework 4.5 (and therefore the EF5 version of System.Data.Entity.dll assembly). With regards to EntityFramework.dll - up to the version 6 it was build on top of System.Data.Entity.dll (in EF6 the code from System.Data.Entity.dll and EntityFramework.dll was merged and further evolved). If you used EntityFramework.dll in VS2010 it means that it had to be one of the 4.x versions which were EF4. You could continue to use it even with the EF5 version of System.Data.Entity.dll but you will not be able to take the advantage of new features introduced in EF5 (like enums, spatial etc.). Since you decided to move to .NET Framework 4.5/EF5 you should also update your EntityFramework.dll 5.0.0.0. To do that you have to install the NuGet extension (http://docs.nuget.org/docs/start-here/installing-nuget) if you have not already and just install EntityFramework.dll using the package manager console (http://www.nuget.org/packages/EntityFramework/5.0.0). It should replace the 4.x version you have in your project with 5.0.

这篇关于数据库第一代实体框架5 System.Data.Entity vs EntityFramework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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