简体   繁体   English

在Visual Studio 2013中生成.edmx EF6的问题

[英]Issues Generating .edmx EF6 in Visual Studio 2013

I am trying to generate my edmx file for my database in Visual Studio 2013 against either a mssql 2012 or 2008 database server and table set. 我试图在Visual Studio 2013中针对mssql 2012或2008数据库服务器和表集生成我的数据库的edmx文件。 The edmx file generates with out issue, and everything looks fine until i try to compile the project. edmx文件生成没有问题,一切看起来很好,直到我尝试编译项目。 Every single object representing a database table errors out with the following messages. 表示数据库表的每个单个对象都会出错,并显示以下消息。

  1. A using namespace directive can only be applied to namespaces; using namespace指令只能应用于名称空间; 'System' is a type not a namespace 'System'是一种类型而不是命名空间
  2. The type name 'Collections' does not exist in the type 'Model.blah.System' “Model.blah.System”类型中不存在类型名称“Collections”

  3. The type name 'DateTime' does not exist in the type 'Model.blah.System' “Model.blah.System”类型中不存在类型名称“DateTime”

The using statements are correctly located inside the generated codes name space declaration, just like all other EF .edmx files i have seen in the past. using语句正确地位于生成的代码名称空间声明中,就像我过去看到的所有其他EF .edmx文件一样。

The error messages are consistent across the board for all database objects. 所有数据库对象的错误消息都是一致的。 NO matter what i do how i generate the my edmx model it is useless and not usable. 无论我做什么,我如何生成我的edmx模型,它是无用的,不可用。

I am running with Visual Studio 2013 Update 2. I have tried using EF5 and EF6 to no avail. 我正在使用Visual Studio 2013 Update 2.我尝试使用EF5和EF6无济于事。 I need some help figuring out why for the life of me i can't correctly generate my EF model. 我需要帮助找出为什么我的生活无法正确生成我的EF模型。

I'd guess that you have a namespace collision, where the compiler fails because you defined a System class that is ambiguous with the System namespace. 我猜你有一个命名空间冲突,编译器失败,因为你定义了一个与System命名空间不明确的System类。

Rename your System class to something else to solve your problem. 将您的System类重命名为其他内容以解决您的问题。

Found the issue I had a Systems table that would stand for systems of measurement. 发现问题我有一个系统表,代表测量系统。 When EF would process the tables it would remove the s from the end of the table causing a name conflict to occur. 当EF处理表时,它会从表的末尾删除s,导致名称冲突。 I am going to close this question, but wanted to get this out there for people to be aware of. 我打算关闭这个问题,但是想让人们知道这个问题。

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

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