Compartilhar via


Entity SQL Language

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)

  • When using EntityClient to return read-only entity data as rowsets using a EntityDataReader. For more information, see EntityClient Provider for the Entity Framework.

  • If you are already an expert in SQL-based query languages, Entity SQL may seem the most natural to you.

Using Entity SQL with the EntityClient provider

If you want to use Entity SQL with the EntityClient provider, see the following topics for more information:

EntityClient Provider for the Entity Framework

How to: Build an EntityConnection Connection String

How to: Execute a Query that Returns PrimitiveType Results

How to: Execute a Query that Returns StructuralType Results

How to: Execute a Query that Returns RefType Results

How to: Execute a Query that Returns Complex Types

How to: Execute a Query that Returns Nested Collections

How to: Execute a Parameterized Entity SQL Query Using EntityCommand

How to: Execute a Parameterized Stored Procedure Using EntityCommand

How to: Execute a Polymorphic Query

How to: Navigate Relationships with the Navigate Operator

Using Entity SQL with object queries

If you want to use Entity SQL with object queries, see the following topics for more information:

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: Call a User-Defined Function

How to: Filter Data

How to: Sort Data

How to: Group Data

How to: Aggregate Data

How to: Execute a Query that Returns Anonymous Type Objects

How to: Execute a Query that Returns a Collection of Primitive Types

How to: Query Related Objects in an EntityCollection

How to: Order the Union of Two Queries

How to: Page Through Query Results

In This Section

Entity SQL Overview

Entity SQL Reference

See Also

Concepts

ADO.NET Entity Framework

Other Resources

Language Reference