Querying a Conceptual Model
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:
Query Type | Description |
---|---|
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 |
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:
|
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.
In This Section
Directly Executing Store Commands
How to: Execute a Query that Returns Entity Type Objects
How to: Execute a Parameterized Query
How to: Navigate Relationships Using Navigation Properties
How to: Use Query Paths to Shape Results
How to: Explicitly Load Related Objects
How to: Use Lazy Loading to Load Related Objects
How to: Call a User-Defined Function
How to: Execute a Query that Returns Anonymous Type Objects
How to: Execute a Query that Returns a Collection of Primitive Types
How to: Return a Specific Object Using its Key
How to: Query Related Objects in an EntityCollection
How to: Order the Union of Two Queries
How to: Page Through Query Results
How to: View the Store Commands
How to: Remove Duplicate Elements From Query Results
How to: Execute a Query Using a Stored Procedure with In and Out Parameters
How to: Query Objects with Multiple Entity Sets per Type
How to: Query an Entity Mapped to Separate Tables
How to: Directly Execute Commands Against the Data Source
Related Topics
See Also
Concepts
Working with Objects
EntityClient Provider for the Entity Framework
Queries in LINQ to Entities
Entity Framework Resources
Defining and Managing Relationships