Chapter 5. Loading Entities and Navigation Properties

Entity Framework provides a rich modeling environment representing a conceptual view of the underlying objects and relationships in data storage. The recipes in this chapter show you how to control the loading of instances of related entities in your queries.

The default behavior for Entity Framework is to load only the entities directly accessed by your application. In general, this is exactly what you want. If Entity Framework aggressively loaded all the entities related through one or more associations, you would likely end up loading more entities than you needed. This would increase the memory footprint of your application and slow it down.

In Entity Framework, you can control when the loading ...

Get Entity Framework 4.0 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.