Chapter 11. Introducing Entity SQL
Most O/RM tools have a proprietary query language that's based on SQL with object-oriented extensions or an object query language (OQL). For example, Hibernate and NHibernate use Hibernate Query Language (HQL), LLBLGen Pro generates dynamic SQL, and Genome uses an OQL with a syntax similar to C#. The primary incentives for providing a proprietary query language are to enable querying persistence stores from multiple RDBMS vendors and, in most cases, to handle nonrelational features such as collections, associations, many:many relationships, and inheritance hierarchies. Product-specific LINQ implementations can eliminate the need for developers to learn multiple query languages. The three example O/RM tools have their own LINQ variations, which this book calls LINQ to NHibernate, LINQ to LLBLGen, and LINQ to Genome.
The Entity Framework's proprietary SQL dialect is Entity SQL, often called eSQL. eSQL queries operate at the Entity Data Model's conceptual layer and execute against the EntityClient
object to deliver a high-performance EntityDataReader
. The EntityDataReader
returns DbDataRecord
s that implement IExtendedDataRecord
to support hierarchies for entities with associations. Alternatively, you can execute an eSQL ObjectQuery
against the Object Services layer to return an ObjectQueryResult
collection of EntityType
or anonymous type instances. Chapter 12 covers executing eSQL queries against the Object Services layer.
eSQL's syntax is similar to ...
Get Professional ADO.NET 3.5 with LINQ and the Entity Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.