I have a query below, but I want to perform an Include() to eager load properties. Actions has a navigation property, User (Action.User)
1) My basic query:
Doing the basic query mentioned in your posted question you won't be able to see the User properties unless you return an anonymous type as following:
from a in Actions
join u in Users on a.UserId equals u.UserId
select new
{
actionUserId = a.UserId
.
.
.
userProperty1 = u.UserId
};
However to use the Include method on the ObjectContext you could use the following:
Make sure you have LazyLoading off by using the following line:
entities.ContextOptions.LazyLoadingEnabled = false;
Then proceed by
var bar = entities.Actions.Include("User");
var foo = (from a in bar
select a);