我有个实体测试。它包含导航属性问题,问题包含导航属性QuestionLocale。
var test = context.Tests
.Include("Question")
.FirstOrDefault();
按预期工作。但是如何包括QuestionLocale呢?
发布于 2020-01-09 11:37:55
你也可以用一种强类型的方式来做。
var test = context.Tests
.Include(x => x.Question.Select(child => child.QuestionLocale))
.FirstOrDefault()
发布于 2022-05-15 22:57:05
现在有了ThenInclude
,见Microsoft文档,它帮我解决了
var test = context.Tests.Include(x => x.Question).ThenInclude(q => q.QuestionLocale).FirstOrDefault();
https://stackoverflow.com/questions/614809
复制