Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework EF 4.4冻结大表查询_Entity Framework_Entity Framework 4 - Fatal编程技术网

Entity framework EF 4.4冻结大表查询

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

我在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.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之后就可以了,谢谢。