当前位置:网站首页>Error: the specified LINQ expression contains a reference to a query associated with a different context

Error: the specified LINQ expression contains a reference to a query associated with a different context

2022-06-26 07:17:00 javail

problem :

I am receiving the error shown in the title from a LINQ query that includes two tables from two different edmx files. I received LINQ Error displayed in query title , The query includes data from two different edmx Two tables of the file .Here is the query: This is a query :

var query = (from a in db1.Table1           join b in db1.Table2 on a.Id equals b.Id           orderby a.Status           where b.Id == 1 && a.Status == "new"           select new           {               Id = a.Id,               CompanyId = (from c in db2.Company                            where s.Id == a.Id                            select                            new { c.CompanyId })           });

db1 and db2 are contexts that are associated with two different edmx files.db1 and db2 Is different from two edmx Context associated with the file .How can I overcome this error? How can I overcome this mistake ?


Solution :

Reference resources : https://stackoom.com/en/question/Ulcu
原网站

版权声明
本文为[javail]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202171201016711.html