Entity Framework is a framework for creating entities. Another Navigation property's Include() navigation

.net entity-framework

Question

I have a thing called zzz-5 zzz. It includes the Navigation Property Question, and the Navigation Property Question is also present.

var test = context.Tests
       .Include("Question")
       .FirstOrDefault();

functions as intended. But how is the QuestionLocale feasible to include?

1
33
3/30/2012 1:46:17 AM

Accepted Answer

One option is:


var test = context.Tests
                  .Include("Question.QuestionLocale")
                  .FirstOrDefault();

63
6/7/2019 3:33:21 AM

Popular Answer

You may also achieve it with forceful typing.

var test = context.Tests
                .Include(x => x.Question.Select(child => child.QuestionLocale))
                .FirstOrDefault()


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow