我编写了一个linq查询,并且Inculde
中的GroupJoin
没有正确转换为SQL。
return questionsDataSet
.AsNoTracking()
.Include(entity => entity.QuestionAudioFile)
.Include(entity => entity.Examination)
.Where(item => !item.QuestionAudioFile.IsDeleted)
.Where(item => !item.IsDeleted)
.Where(item => item.ExaminationId == examId)
.GroupJoin(questionAnswersDataSet
.Include(item => item.Answer),
question => question.Id,
questionAnswer => questionAnswer.QuestionId,
(question, questionAnswer) => new QuestionWithAnswers
{
Question = question,
QuestionAnswers = questionAnswer
})
.OrderByDescending(item => item.Question.Id)
.ToArrayAsync();
因此,它会运行并显示警告:
Microsoft.EntityFrameworkCore.Query-LINQ表达式'“ join 回答问题 值(Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1 [Gillie.Gazoo.Database.Entities.Examination.Answer]) 在Property([questionAnswer],\“ AnswerId \”)上等于 Property([questionAnswer.Answer],\“ Id \”)“'无法翻译 并将在本地进行评估。
有人可以帮助我理解为什么此代码带有警告吗?