LINQ加入花了很多时间

时间:2014-10-08 07:43:17

标签: c# linq join

我目前正在使用以下linq查询

lsttask = (from d in administrationEntities.Tasks
  .Include("Status")
  .Include("Priority")
  .Include("Batch")
  .Include("Batch.ShipmentGroup")
  .Include("Batch.ShipmentGroup.Shipment")
  .Include("Batch.ShipmentGroup.Shipment.TOCShipmentManifests.TOCShipmentDetails.TOCShipmentProcesses")
  .Include("Batch.ShipmentGroup.Shipment.Project")
  .Include("TaskType")
     where ((projectId == null ? true : d.Batch.ShipmentGroup.Shipment.Project.ProjectId == projectId) 
         && ( statusId == null ? true : d.StatusId == statusId) 
         && d.IsDeleted == false)
     select d)
  .ToList();

但真正耗费时间,比如高达30多秒 是否有另一种方法可以缩短执行时间?

0 个答案:

没有答案