简体   繁体   中英

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. The edmx file generates with out issue, and everything looks fine until i try to compile the project. Every single object representing a database table errors out with the following messages.

  1. A using namespace directive can only be applied to namespaces; 'System' is a type not a namespace
  2. The type name 'Collections' does not exist in the type 'Model.blah.System'

  3. The type name 'DateTime' does not exist in the type 'Model.blah.System'

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.

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.

I am running with Visual Studio 2013 Update 2. I have tried using EF5 and EF6 to no avail. I need some help figuring out why for the life of me i can't correctly generate my EF model.

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.

Rename your System class to something else to solve your problem.

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. I am going to close this question, but wanted to get this out there for people to be aware of.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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