简体   繁体   English

EF 4.3.1与VS 2011

[英]EF 4.3.1 with VS 2011

I need to know if it is possible to start using the latest version of EF (4.3.1) with VS 2011 without having to install these CTP components as stated here . 我需要知道是否可以在VS 2011中开始使用最新版本的EF(4.3.1),而无需安装这里所述的这些CTP组件。

I had these components installed but I removed them and since then I can't add a new edmx file to .net 4 targeted project; 我安装了这些组件,但我删除了它们,从那时起我就无法将新的edmx文件添加到.net 4目标项目中; it complains about missing reference to System.Data.Entity. 它抱怨缺少对System.Data.Entity的引用。

Do I need to re install VS 2011? 我需要重新安装VS 2011吗?

After I removed and reinstalled Visual Studio, I still couldn't get red of the error, so I used process monitor to log what Visual Studio is doing with System.Data.Entity as a path filter, turned out that Visual Studio was reading from 在我删除并重新安装Visual Studio之后,我仍然无法得到错误的红色,因此我使用进程监视器记录Visual Studio正在使用System.Data.Entity作为路径过滤器,结果是Visual Studio正在读取

C:\\Windows\\Microsoft.NET\\assembly\\GAC_MSIL\\policy.4.0.system.data.entity v4.0_0.0.0.0__b77a5c561934e089\\policy.4.0.system.data.entity.config C:\\ Windows \\ Microsoft.NET \\ assembly \\ GAC_MSIL \\ policy.4.0.system.data.entity v4.0_0.0.0.0__b77a5c561934e089 \\ policy.4.0.system.data.entity.config

which had binding to the 哪个有绑定的

System.Data.Entity.dll v 4.2.0.0 System.Data.Entity.dll v 4.2.0.0


once I cleared the file VS was worked like charm. 一旦我清除了文件VS就像魅力一样。

The CTP uninstall left this out. CTP卸载离开了这个。

Yeah should work with no issues using .net 4, however theres a list of known issues when using .net 4.5. 是的,应该使用.net 4没有问题,但是使用.net 4.5时已知问题列表。 You dont need to re-install vs to get version 4.3.1 of entity framework, simply install it from the nuget package gallery and if you are using .net 4 it all seems to just work. 你不需要重新安装vs来获得实体框架的4.3.1版本,只需从nuget包库中安装它,如果你使用的是.net 4,它似乎只是工作。

Issues listed when installing EF4.3.1 on .net 4.5 include those listed below. 在.net 4.5上安装EF4.3.1时列出的问题包括下面列出的问题。


Known Issues with Entity Framework 4.x and .NET Framework 4.5 Entity Framework 4.x和.NET Framework 4.5的已知问题

Entity Framework 4.1 thru 4.3 included additional data annotations in the System.ComponentModel.DataAnnotations namespace in the EntityFramework assembly. 实体框架4.1至4.3在EntityFramework程序集的System.ComponentModel.DataAnnotations命名空间中包含其他数据注释。 In .NET 4.5 these annotations were moved to be part of the .NET Framework in the System.ComponentModel.DataAnnotations.Schema namespace of the System.ComponentModel.DataAnnotations.dll assembly. 在.NET 4.5中,这些注释被移动到System.ComponentModel.DataAnnotations.dll程序集的System.ComponentModel.DataAnnotations.Schema命名空间中的.NET Framework的一部分。 If you are using EF 4.x and targeting .NET 4.5 this results in two data annotations with the same name in different assemblies. 如果您使用的是EF 4.x并以.NET 4.5为目标,则会在不同的程序集中生成两个具有相同名称的数据注释。 Because the annotations in the .NET Framework are in a different namespace we were not able to use type forwarding to avoid this conflict. 由于.NET Framework中的注释位于不同的命名空间中,因此我们无法使用类型转发来避免此冲突。

It is possible to use EF 4.x on .NET 4.5 but we recommend using the latest pre-release version of EF 5. If you are not using the affected data annotations there is no impact on your code. 可以在.NET 4.5上使用EF 4.x,但我们建议使用最新的EF 5预发布版本。如果您没有使用受影响的数据注释,则不会对您的代码产生任何影响。 If you are using the data annotations in a C# project you can use the extern modifier to ensure your code uses the annotations from EntityFramework.dll (http://msdn.microsoft.com/en-us/library/e59b22c5(v=VS.80).aspx). 如果您在C#项目中使用数据注释,则可以使用extern修饰符来确保您的代码使用EntityFramework.dll中的注释(http://msdn.microsoft.com/en-us/library/e59b22c5(v=VS) 0.80)的.aspx)。 If you use the new annotations from the System.ComponentModel.DataAnnotations.dll assembly in .NET 4.5 they will not be processed by Code First. 如果您使用.NET 4.5中的System.ComponentModel.DataAnnotations.dll程序集中的新注释,它们将不会由Code First处理。

The affected annotations are: 受影响的注释是:

  • Column
  • ComplexType 的ComplexType
  • DatabaseGenerated DatabaseGenerated
  • DatabaseGeneratedOption DatabaseGeneratedOption
  • ForeignKey ForeignKey的
  • InverseProperty InverseProperty
  • MaxLength 最长长度
  • MinLength 使用MINLENGTH
  • NotMapped NotMapped
  • Table

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM