Linq到SQL没有正确翻译

时间:2019-06-17 11:27:27

标签: c# linq entity-framework-core

我编写了一个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 \”)“'无法翻译   并将在本地进行评估。

有人可以帮助我理解为什么此代码带有警告吗?

0 个答案:

没有答案