实体框架程序集中的重复类型名称 (6.1.0) [英] Entity Framework Duplicate type name within an assembly (6.1.0)
问题描述
我不确定发生了什么,但在执行查询时我不断收到以下异常.程序集中的重复类型名称."我一直无法在网上找到解决方案.我通过从解决方案中的所有项目中删除实体框架并使用 nugget 重新安装来解决该问题.然后突然之间异常又回来了.我一遍又一遍地验证了我的表模式,并没有发现任何问题.
I am not sure what is going on but I keep getting the following exception when doing a query. "Duplicate type name within an assembly." I have not been able to find a solution on the web. I had resolved the issue by removing entity framework from all the projects in the solutions and re-installing using nugget. Then all of the sudden the exception is back. I have verified my table schema over and over and find nothing wrong with.
这是导致异常的查询.
var BaseQuery = from Users in db.Users
join UserInstalls in db.UserTenantInstalls on Users.ID equals UserInstalls.UserID
join Installs in db.TenantInstalls on UserInstalls.TenantInstallID equals Installs.ID
where
Users.Username == Username
&& Users.Password == Password
&& Installs.Name == Install
select Users;
var Query = BaseQuery.Include("UserTenantInstalls.TenantInstall");
return Query.FirstOrDefault();
正如我之前提到的,同样的查询之前也有效.数据没变,代码没变.
As I mentioned previously the same query was working before. The data has not changed and the code has not changed.
推荐答案
作为一种变通方法,只有在您使用调试器单步执行时才会发生这种情况.如果您将断点放置在源代码内部的几行下方,则不会显示错误.
As a work around, this only happens if you are single-stepping using the debugger. If you place your break point a few lines further down inside your source, the error will not show up.
我还没有卸载,这至少可以让我继续工作.
I haven't uninstalled, and this at least allows me to continue working.
这篇关于实体框架程序集中的重复类型名称 (6.1.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!