Entity SQL Overview

Entity SQL is a SQL-like language that enables you to query conceptual models in the Entity Framework. Conceptual models represent data as entities and relationships, and Entity SQL allows you to query those entities and relationships in a format that is familiar to those who have used SQL.

The Entity Framework works with storage-specific data providers to translate generic Entity SQL into storage-specific queries. The EntityClient provider supplies a way to execute an Entity SQL command against an entity model and return rich types of data including scalar results, result sets, and object graphs. When you construct EntityCommand objects, you can specify a stored procedure name or the text of a query by assigning an Entity SQL query string to its EntityCommand.CommandText property. The EntityDataReader exposes the results of executing a EntityCommand against an EDM. To execute the command that returns the EntityDataReader, call ExecuteReader.

In addition to the EntityClient provider, the Entity Framework enables you to use Entity SQL to execute queries against a conceptual model and return data as strongly typed CLR objects that are instances of entity types. For more information, see Working with Objects.

This section provides conceptual information about Entity SQL.

In This Section

How Entity SQL Differs from Transact-SQL

Entity SQL Quick Reference

Type System

Type Definitions

Constructing Types

Query Plan Caching

Namespaces

Identifiers

Parameters

Variables

Unsupported Expressions

Literals

Null Literals and Type Inference

Input Character Set

Query Expressions

Functions

Operator Precedence

Paging

Comparison Semantics

Composing Nested Entity SQL Queries

Nullable Structured Types

See also