O'Reilly logo

Microsoft Visual Studio 2015 Unleashed, Third Edition by Mike Snell, Lars Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

using (AdventureWorksEntities entities = new AdventureWorksEntities())   {      List<Employee> employees =          (from e in entities.Employees           where e.SalariedFlag == true select e).ToList();   }

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required