简体   繁体   English

在带有EF5和测试单元的VS2012 Express中使用枚举

[英]Using Enum in VS2012 Express with EF5 and test Units

I'm having an issue with VS2012 express web 我在VS2012 Express Web上遇到问题

I use a VS2012 pro and my partner use a VS2012 express web. 我使用VS2012专业版,而我的伴侣使用VS2012 Express网站。

We share the same project, using EF5 code first. 我们共享同一项目,首先使用EF5代码。

In a model description i use an enum. 在模型描述中,我使用枚举。

On my computer with VS2012 Pro i had no problem to create a database in test units. 在装有VS2012 Pro的计算机上,我可以在测试单元中创建数据库没有问题。 On the computer of my partner with VS2012 express web, VS returns an error, telling it can not handle the enum. 在我使用VS2012 Express Web的伙伴的计算机上,VS返回错误,告诉它无法处理该枚举。

here is the error message (sorry it is in french) 这是错误消息(对不起,它是法文)

Message de résultat : 消息发送至:
La méthode d'initialisation prjAGE.Metier.Test.Tests.AnnuaireDesTiers.TU_RepositoryContact.MyTestInitialize a levé une exception. 初始化prjAGE.Metier.Test.Tests.AnnuaireDesTiers.TU_RepositoryContact.MyTest初始化级别异常。 System.Data.MetadataException: System.Data.MetadataException: Le schéma spécifié n'est pas valide. System.Data.MetadataException:System.Data.MetadataException:最有效的方法。 Erreurs : Impossible de trouver un type de couche objet correspondant au type conceptuel 'AGE.Metier.DAL.EnumCivilite'. Erreurs:不可能排除沙发上的物体,也不可能是au型概念的“ AGE.Metier.DAL.EnumCivilite”。

We already have checked that all updates have been done and the version of EF5 given by NuGet. 我们已经检查了所有更新是否已完成以及NuGet提供的EF5版本。

What have we missed ? 我们错过了什么?

Jean-Baptiste 让·巴蒂斯特(Jean-Baptiste)

There should be no problem caused by your Visual Studio version. 您的Visual Studio版本不会造成任何问题。 However this issue seems very similar to the problem described here: 但是,此问题似乎与此处描述的问题非常相似:

http://social.msdn.microsoft.com/Forums/en-US/ec37698d-a7ad-4a7d-873d-3ea61c917eed/ef-50-enum-schema-specified-is-not-valid-errors?forum=adodotnetentityframework http://social.msdn.microsoft.com/Forums/zh-CN/ec37698d-a7ad-4a7d-873d-3ea61c917eed/ef-50-enum-schema-specified-is-not-valid-errors?forum=adodotnetentityframework

And there is an issue about enums that span assemblies: http://entityframework.codeplex.com/workitem/532 关于跨程序集的枚举存在一个问题: http : //entityframework.codeplex.com/workitem/532

For further options check whether the web versions VS2012 express web works correctly if you change your EF project and Unit test project to EF 6 because this error might be caused by the limitations of what projects the VS2012 express can edit as EF 5 still uses the System.Data.Entity dll while in the EF 6 only the whole code base was moved to the EntityFramework.dll (while the namespace for those classes are still System.Data.Entity of course) 对于其他选项,如果将EF项目和单元测试项目更改为EF 6,请检查VS2012 Express Web版本是否正常工作,因为该错误可能是由于VS2012 Express可以编辑哪些项目的限制所致,因为EF 5仍使用系统.Data.Entity dll,而在EF 6中,只有整个代码库都移到了EntityFramework.dll(当然,这些类的名称空间仍然是System.Data.Entity)

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

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