Schema specified is not valid. Errors: Multiple types with the name

白昼怎懂夜的黑 提交于 2019-12-23 12:25:10

问题


I am working in EF 6 and facing the following issue when I try run my project.

Schema specified is not valid. Errors:

Multiple types with the name 'TableName' exist in the EdmItemCollection in different namespaces. Convention based mapping requires unique names without regard to namespace in the EdmItemCollection.

I tried too much on StackOverFlow and google and found no solution. I am using visual studio 2012. I crated a single .edmx file for whole of my database. I searched the tableName throughout the project and there is single occurrence of table.

Please help me in this regard


回答1:


Finally I figured out the solution of the problem. In my question above, I stated that I have only single edmx file in my project. It is true in one sense. But wrong in the other sense.

I am using git to manage my code. I created another edmx file in another project and used that project's reference in my main project.

Then I switched git branch with dll in .gitignore. Those dlls which were in .gitignore could not be replaced by git with the newly switched branch's dlls. So I had two references of edmx files in my project with fully built dlls.

Problem solved when I keenly checked my bin folder and removed the dll which was actually not belonging to the current git branch.

I hope it will help you. Comment here if some thing is not clear. Thanks



来源:https://stackoverflow.com/questions/32142816/schema-specified-is-not-valid-errors-multiple-types-with-the-name

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