04.07.2013 Views

Programming Entity Framework - Cdn.oreilly.com

Programming Entity Framework - Cdn.oreilly.com

Programming Entity Framework - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Entity</strong>Connection and the Connection String 70<br />

<strong>Entity</strong>Command 71<br />

ExecuteReader 71<br />

Forward-Only Access to the Fields 71<br />

Translation to Database Queries 72<br />

Pay Attention to the .NET Method’s Impact on Generated SQL 73<br />

Avoid Inadvertent Query Execution 74<br />

Summary 75<br />

4. Exploring EDM Queries in Greater Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77<br />

Same Model, Friendlier Name 78<br />

Projections in Queries 79<br />

Projections in LINQ to Entities 80<br />

LINQ Projections and New Language Features 80<br />

Projections with LINQ Query Methods 84<br />

Projections in <strong>Entity</strong> SQL 84<br />

DbDataRecords and Nonscalar Properties 86<br />

Projecting with Query Builder Methods 87<br />

Querying Across Associations 87<br />

Navigation to an <strong>Entity</strong>Reference 88<br />

Filtering and Sorting with an <strong>Entity</strong>Reference 90<br />

Navigating to <strong>Entity</strong> Collections 91<br />

Projecting Properties from <strong>Entity</strong>Collection Entities 92<br />

Filtering and Sorting with <strong>Entity</strong>Collections 93<br />

Aggregates with <strong>Entity</strong>Collections 94<br />

<strong>Entity</strong> SQL SET Operators 96<br />

Aggregates in LINQ Methods and Query Builder Methods 96<br />

Joins and Nested Queries 97<br />

Joins 97<br />

Nested Queries 99<br />

Grouping 101<br />

Naming Properties When Grouping 103<br />

Chaining Aggregates 103<br />

Filtering on Group Conditions 104<br />

Grouping in <strong>Entity</strong> SQL 105<br />

Shaped Data Returned by Queries 107<br />

Shaped Data from <strong>Entity</strong> SQL 109<br />

Deferred Loading and Eager Loading Queries 111<br />

Deferred Loading <strong>Entity</strong> Collections with Load 111<br />

Using the Include Method to Eager-Load 113<br />

Using Include with an ObjectQuery 115<br />

Pros and Cons of Load and Include 116<br />

Retrieving a Single <strong>Entity</strong> 117<br />

Table of Contents | vii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!