指定的架构无效.错误:多种类型的名称 [英] Schema specified is not valid. Errors: Multiple types with the name

查看:365
本文介绍了指定的架构无效.错误:多种类型的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在EF 6中工作,并且在尝试运行项目时遇到以下问题.

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

指定的架构无效.错误:

Schema specified is not valid. Errors:

名称为"TableName"的多种类型存在于 EdmItemCollection在不同的名称空间中.基于约定的映射 需要唯一的名称,而无需考虑名称空间中的 EdmItemCollection.

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.

我在StackOverFlow和google上尝试了太多,但没有找到解决方案.我正在使用Visual Studio2012.我为整个数据库创建了一个.edmx文件.我在整个项目中搜索了tableName,并且只出现了一次table.

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.

在这方面请帮助我

推荐答案

最后,我找到了解决问题的方法. 在上面的问题中,我说我的项目中只有一个edmx文件.从某种意义上说这是真的.但是从另一种意义上说是错误的.

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.

我正在使用git来管理我的代码.我在另一个项目中创建了另一个edmx文件,并在我的主项目中使用了该项目的引用.

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.

然后我用.gitignore中的dll切换了git分支.那些.gitignore中的dll无法用新切换的分支的dll替换为git. 因此,在我的项目中,具有完全构建的dll的edmx文件有两个引用.

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.

当我敏锐地检查我的bin文件夹并删除实际上不属于当前git分支的dll时,问题解决了.

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

这篇关于指定的架构无效.错误:多种类型的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆