Reputation: 2499
For example, i have a class Unit
it has one object City
. Unit
also has Category
object. How to tell EF4 to load City object using this similar linq query, but not Category
?
from u in db.Units
orderby u.Name
select u
Upvotes: 2
Views: 61
Reputation: 4951
You can indicate that those should be included, like so:
from u in db.Units.Include("City")
orderby u.Name
select u
I believe this can also be done like this:
db.Units
.Include(u => u.City)
.OrderBy(u => u.Name);
Upvotes: 3