Entity framework EF 4.4冻结大表查询
我在ASP.NETMVC项目上使用EF4.4和SQL server,每次运行时我都会冻结下面的查询Entity framework EF 4.4冻结大表查询,entity-framework,entity-framework-4,Entity Framework,Entity Framework 4,我在ASP.NETMVC项目上使用EF4.4和SQL server,每次运行时我都会冻结下面的查询 PSSAL有426000行,而PU_CustProduct有1600行 你有什么想法或建议可以询问吗 var model = (from p in dbCont.PU_CustProduct where !(from pt in dbCont.PSSAL where pt.PSSAL_DATE > d1 && pt.PSS
PSSAL
有426000行,而PU_CustProduct
有1600行
你有什么想法或建议可以询问吗
var model = (from p in dbCont.PU_CustProduct
where !(from pt in dbCont.PSSAL
where pt.PSSAL_DATE > d1
&& pt.PSSAL_PSPRP_ID == p.CustProductID
select pt.PSSAL_PSPRP_ID).Contains(p.CustProductID)
&& p.IsActive == true
&& (!p.IsSleepMode == true)
&& p.ProductType == intId
&& p.CustomerID != null
&& p.IsSychSuspend != true
select new WarningViewModel
{
PrpName = p.LicenceName,
CrmID = p.CustomerID.ToString(),
PsprpId = p.CustProductID.ToString(),
}).Distinct().OrderBy(o => o.PrpName).ToList();
为什么有那么多参数需要检查?
(!p.IsSleepMode==true)
是否与p.IsSleepMode==false
相同?发布生成的SQL以供查看。使用SQL事件探查器或类似EF事件探查器的工具。如果使用查询事件探查器手动执行生成的查询,需要多长时间?DaveHogan,生成SQL之后就可以了,谢谢。