The ADO.NET Entity Framework enables you to query a conceptual model. The Entity Framework supports the following kinds of queries against a conceptual model:
Language Integrated Query (LINQ)
LINQ to Entities enables you to execute LINQ queries against entity data by using language-specific query operators. For more information, see LINQ to Entities.
Entity SQL is a storage-independent query language that is similar to SQL. Entity SQL allows you to query entity data, either as objects or in a tabular form. You should consider using Entity SQL in the following cases:
When a query must be dynamically constructed at runtime. In this case, you should also consider using the query builder methods of ObjectQuery instead of constructing an Entity SQL query string at runtime.
When you want to define a query as part of the model definition. Only Entity SQL is supported in a data model. For more information, see QueryView Element (MSL)
If you are already an expert in SQL-based query languages, Entity SQL may seem the most natural to you.
Query builder methods
These methods of ObjectQuery enable you to construct queries that are the same as Entity SQL without having to construct a query string. Because these methods always return an ObjectQuery, you can build queries by calling methods in series or use them to extend an Entity SQL query. Some methods, such as Where and OrderBy, take Entity SQL fragments as parameters. Query builder methods can be followed by certain LINQ standard query operators. For more information, see Query Builder Methods.
The topics in this section describe how to use the ObjectQuery class to query a conceptual model. For more information about executing LINQ queries against a conceptual model, see Queries in LINQ to Entities.