Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 280
Chris Hogan Avatar asked Dec 11 '22 03:12

Chris Hogan


2 Answers

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.

like image 115
Nathan A Avatar answered Dec 17 '22 22:12

Nathan A


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.

like image 31
Chris Hogan Avatar answered Dec 17 '22 22:12

Chris Hogan