I would like to use eager loading for load related entities and I see this page:
In this example I can see that there are two ways to get the related entities:
var princesses1 = context.Princesses
.Include(p => p.Unicorns)
.ToList();
var princesses1 = context.Princesses
.Include("Unicorns")
.ToList();
The first way is to use the lambda expression (I think that correct name is that, if not, correct me), and the second way is to use a string with the name of the related entity.
In my case, I can use the second, because in the firt way, when I can't get the property of the related entity in the lambda expression. I use this code:
IQueryable<Customers> myQuery;
myQuery = myContext.Customers.Include("Orders");
But if I try to use the second way:
IQueryable<Customers> myQuery;
myQuery = myContext.Customers.Include(c=>c.?????);
I can't select the Orders property.
Why?