Building Project that uses EntityFramework fails with a lot of errors

无人久伴 提交于 2020-02-07 17:08:49

问题


I am using EntityFramework as my Data Access Layer in a Visual Studio C# project. I have added a new entity model and built right away without adding or doing anything to test its functionality. Unfortunately, the build failed with many errors like:

CS0426  The type name 'Data' does not exist in the type 'System'
CS0138  A 'using namespace' directive can only be applied to namespaces; 'System' is a type not a namespace. Consider a 'using static' directive instead    
CS0246  The type or namespace name 'Nullable<>' could not be found (are you missing a using directive or an assembly reference?)

The code editor itself appears as though it is missing something even though every thing is in place

The pictures show both the editor and the references that I have in my project

P.S: The project type is Class Library


回答1:


Apparently, it is all my mistake. I had a table in the Database called "Systems" and when Entity Framework turned the plural into singular it became "System" class which caused confusion and ambiguity to the compiler. Consequently, the compiler could not correctly resolve the type.



来源:https://stackoverflow.com/questions/42159307/building-project-that-uses-entityframework-fails-with-a-lot-of-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!