Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 506
Lali Avatar asked Aug 21 '15 14:08

Lali


1 Answers

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

like image 162
Lali Avatar answered Oct 14 '22 07:10

Lali