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.
This is the query causing the exception.
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.
This is a new issue with EF 6.1.0, and the EF team is aware of the problem:
https://entityframework.codeplex.com/workitem/2228
Faced the same in my WCF webservice
recently. Just clean your solution and rebuild it. This should fix the issue.
None of the above seem to work for me however in the link specified earlier i did fin this, which worked for me. This was submitted by 'bunomonteiro'
To Fix "Duplicate type name within an assembly"
I had similar issue. I checked all my models/classes and I have not used duplicate names for types. I deleted the assemblies and regenerated the the model and context object from the database and still had the same issue.
A trace yielded in Visual Studio "Children could not be evaluated". The SOLUTION is to add .ToList(); or ToArray(); or ToDictionary() etc, to your query. etc.
eg. var query = context.TableName.Where(x => x.name =="CodeRealm").ToList();
PingBack - http://entityframework.codeplex.com/workitem/1898
bunomonteiro wrote Jul 18 at 3:37 AM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With