我有一个 linq 查询,需要 31 秒。这是我第一次收到这么晚的询问,我不知道该怎么办。让我向您展示我的查询:
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();
}
Run Code Online (Sandbox Code Playgroud)
我确信这是一个正确的查询,但我不知道为什么该查询花费了太多时间。
谢谢你的帮助!!
linq asp.net asp.net-mvc ef-code-first entity-framework-core