【发布时间】:2021-07-18 11:20:57
【问题描述】:
我有一个需要 31 秒的 linq 查询。这是我第一次收到这么晚的查询,我不知道该怎么办。 让我告诉你我的查询:
public IEnumerable<WebFairField> WebFairFieldForFair(Guid ID)
{
return TradeTurkDBContext.WebFairField.Where(x => x.DataGuidID==ID)
.Include(x => x.Category)
//
.Include(x=>x.FairSponsors)
.ThenInclude(x=>x.Company)
.ThenInclude(x=>x.FileRepos)
//
.Include(x=>x.WebFairHalls)
.ThenInclude(x=>x.HallSeatingOrders)
.ThenInclude(x=>x.Company)
.ThenInclude(x=>x.FileRepos)
//
.Include(x=>x.HallExpertComments)
.Include(x=>x.Products)
.Include(x=>x.FairSponsors)
.AsNoTracking().ToList();
}
我确定这是一个正确的查询,但我不知道为什么该查询花费了太多时间。
感谢您的帮助!!
【问题讨论】:
标签: asp.net asp.net-mvc linq entity-framework-core ef-code-first