Entity Client

Published 14 February 07 02:51 PM | dpblogs 

 

With the next release of the .NET Framework, ADO.NET will introduce a new member of the family of data providers – EntityClient. The mission of EntityClient is to provide a gateway for entity-level queries. Through EntityClient one queries against a conceptual model, not against a specific store implementation of that model. EntityClient does not directly communicate with the data store but it requires a separate, store-specific, provider. EntityClient can work in conjunction with SqlClient that come in the ADO.NET bundle. Additionally, we have launched a partner program to help third-parties produce compatible store providers.

 

EntityClient employs its own language, Entity SQL. An Entity SQL query needs no change in order to work over different store implementations of the same model. That is achieved through EntityClient’s pluggable architecture. Its query pipeline compiles the Entity SQL text to a command tree that is passed to the store provider for native SQL generation. Entity SQL result sets are not restricted to a tabular shape – complex hierarchies may be returned. Even if the store provider doesn’t support them the query pipeline will construct them on the fly because that is the Entity SQL contract. Entity SQL is also highly composable. A sub-query may be used anywhere an expression of that type is accepted.

 

Querying a model directly through EntityClient is suitable for high performance model-based applications. EntityClient does not attempt to materialize objects out of the result set. Instead, it returns a plain DbDataReader for which those applications may implement their own specialized object materialization, or consume the DbDataReader directly.

 

As an ADO.NET provider EntityClient follows the well-known pattern of Connection, Command, Parameter, DataReader, etc. where the class names are prefixed by “Entity”. Of course there are some differences that deserve special attention:

 

Connection String

An entity connection string is inevitably more complex than a store connection string because it must include the latter in its entirety plus additional information about the model and the provider itself, e.g.:

 

Provider=System.Data.SqlClient; Metadata=../../model | ../../mapping/sql; Provider Connection String=’Server=zlatkom1; Database=NorthwindCTP; Integrated Security=yes;’ ”

 

·         Provider - the store provider’s canonical name

·         Metadata – a pipe-separated path of folders and individual files where the model and mapping files are stored

·         Provider Connection String – a store specific connection string or the underlying store provider

 

EntityConnection can also read a connection string from the app.config file. In that case one can save multiple connection strings with different names in the app.config file and pass the name of the connection string to be used:

 

Name=Northwind with Integrated Security”

 

Command Text

As it was mentioned earlier, EntityClient uses a new query language – Entity SQL. Just to get a brief sneak at it, here’s an example:

 

SELECT c, c.Products

FROM Northwind.Categories AS c;

 

The above query returns a hierarchical result set that contains all product categories in Northwind and the set of related products for each category. The first thing to notice is it’s very simple. That is because an entity model is shielded from the complexity of database normalization. There is no JOIN between Categories and Products because an entity model has navigable relationships like c.Products that directly return the referred entity or even a collection of entities as in the given example. Lastly, there is no need to project individual columns – Entity SQL can return entire entities instead.

 

A separate blog post, dedicated exclusively to Entity SQL, is coming up soon.

 

INSERT/UPDATE/DELETE

Entity SQL will not support any DML constructs – INSERT, UPDATE, or DELETE in the Orcas release. Data modification could still be done through ObjectContext, or through the native SQL of the target store. It is our goal to implement DML support but for now it’s more important to verify we’ve built the right query language.

 

Feedback Welcome

We strongly encourage user feedback at our dedicated forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=533&SiteID=1. We believe we’ve designed a great product but we still actively trying to understand customers’ needs so we can make it even better. Additionally, our team is committed to help the developer community adopt the new ADO.NET technology to build model-based applications.

 

 

Zlatko Michailov

Program Manager, ADO.NET

Microsoft Corp.

 

Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# John Papa [MVP C#] said on February 14, 2007 8:09 PM:

If you watch the ADO.NET team’s blog then you may have seen the post from today from Zlatko Michailov

# Troy Magennis said on February 14, 2007 8:36 PM:

Another "SQL like, string based language syntax" seems to be a step backwards in the day and age of LINQ and Expression Trees. Wouldn't a set of LINQ providers formulating queries based upon expression trees solved the same problem and fitted better with the whole LINQ Data != Objects story?

What is the advantage of the "Command Tree" rather than and the standard "Expression Tree"?

# LINQed IN - Troy Magennis' View on .NET, C# and Software Development said on February 14, 2007 8:49 PM:

This has been bugging me for a while, but I must now admit how disappointed I am that the ADO.Net team...

# LINQed IN - Troy Magennis' View on .NET, C# and Software Development said on February 14, 2007 11:51 PM:

This is a polarizing post- I really want these issues discussed and debated. I'm interested is anyone...

# Frans Bouma said on February 15, 2007 3:33 AM:

"Entity SQL will not support any DML constructs – INSERT, UPDATE, or DELETE in the Orcas release. Data modification could still be done through ObjectContext, or through the native SQL of the target store. "

I find this a bit strange. Entities of the Entity framework mapped as C# classes can be updated/deleted etc. using Linq/objectcontext, but not through eSql ? Isn't it so, that the expression tree resulting from the objectcontext actions is what you should use for eSQL statements?

# Zlatko Michailov said on February 15, 2007 5:50 PM:

The requirements for update from object- and entity-level are quite different. Update from object-level (ObjectContext or LINQ) operates over individual object instances. There is a separate command tree for each instance that is being updated. The assumption is: the number of object instances is relatively small compared to the total number of instances in the store.

Entity SQL, on the other hand, operates over entity sets. There should be a single command tree that updates a relatively large set of instances. So object-level update trees are not applicable. Entity-level updates target rather maintenance than application development. By the time maintenance becomes an issue, entity-level updates should be implemented.

# Sam Gentile said on February 18, 2007 11:16 AM:

Data/ADO.NET Orcas Two from the ADO.NET team: Entity Client and Nulls - LINQ to DataSets Part 3 Software

# Guy Burstein's Blog said on March 9, 2007 4:53 AM:

According to the ADO.Net Team here and here , there will be no support of DML operations in Entity SQL

# ADO.NET, LINQ, DataSet and other fun .NET technology said on August 3, 2007 4:18 PM:

I was recently asked what a high level list of good starting points for the Entity Framework is. This

# Weddings said on June 6, 2008 2:51 AM:

With the next release of the .NET Framework, ADO.NET will introduce a new member of the family of data providers – EntityClient . The mission of EntityClient is to provide a gateway for entity-level queries . Through EntityClient one queries against

# Blog del CIIN said on September 10, 2008 6:57 PM:

Siguiendo con las pruebas de ADO.NET Entity Framework (ADO.NET EF) comenzadas en este post , en esta

# Sam Gentile's Blog said on December 3, 2008 10:16 AM:

Data/ADO.NET Orcas Two from the ADO.NET team: Entity Client and Nulls - LINQ to DataSets Part 3 Software Architecture/SOA/CAB Udi answers, Can or should SOA be implemented without Web Services? David Chappell on The Three Faces of SOA Eric Newcomer: WS-*

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker