3
我越來越想在查詢中加入對多表時的錯誤關聯查詢引用:指定的LINQ表達式包含對與不同的上下文
指定的LINQ表達式包含引用到關聯查詢用不同的上下文
很混亂,因爲它使得它看起來像我使用的查詢中不同的情況下,但我不:
public static IQueryable<Company> GetAll(bool supportsMMAT)
{
return from c in Context.Companies
join v in Context.Vehicles on c.CompanyIdNumber equals v.CompanyIdNumber
join mt in Context.ModemTypes on v.ModemTypeId equals mt.Id
where !c.CompanyShutOff
&& (!supportsMMAT || mt.Model == "MMAT")
select c;
}
任何想法S'我使用的EF4 CTP5代碼的第一種方法,如果這有什麼區別...
Context屬性是否每次調用都返回一個新的上下文? – DamienG 2010-12-27 17:14:27