LINQ and the Entity Data Model

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

LINQ to Entities allows developers to create flexible, strongly typed queries against the Entity Data Model (EDM) Object Context by using LINQ expressions and the LINQ standard query operators. This enables a user to write strongly-typed, composable queries in a Transact-SQL-like syntax, directly from the development environment. The queries are expressed in the programming language itself and not as string literals embedded in the application code, which is usually the case in applications written on the Microsoft .NET Framework version 2.0. Syntax errors as well as errors in member names and data types will be caught by the compiler and reported at compile time, reducing the potential for type problems between the EDM model and the application.

When an application uses the EDM, mapping between the conceptual data model and the underlying data source is handled automatically. A developer can create a LINQ to Entities application without any knowledge of the underlying data source or specific methods for querying the data source. This also allows the back end data source to be changed without requiring changes to the client application, because most database-specific features are handled by Object Services. For more information, see Object Services Overview (Entity Framework).

LINQ to Entities queries use the Object Services infrastructure. The ObjectContext class is the primary class for interacting with an EDM as CLR objects. The developer constructs an ObjectQuery instance through the ObjectContext. The generic ObjectQuery class represents a query that returns an instance or collection of typed entities. Entity objects returned by ObjectQuery are tracked by the Object Context and can be updated by using the SaveChanges method.

See Also

Other Resources

LINQ to Entities

Community Additions