Querying Against the Entity Data Model

The real power of EF is the ability to perform SQL-like operations against a set of objects (for example, the objects you have defined in your entity data model) using a variety of different methods.

Because every object in EF is LINQ enabled, we could use LINQ to Entities to query for a list of salaried employees like this:

image

The AdventureWorksEntities object seen on the first line of code above represents our conceptual model; LINQ provides the syntax we need to iterate over those objects within the AdventureWorksEntities object.

EF also supports the ability to construct queries using the ObjectQuery class. ...

Get Microsoft® Visual Studio® 2010 Unleashed 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.