views:

115

answers:

2

Is LINQ to Dataset subset of LINQ to EF or these two are independent?

+5  A: 

They are independent.

  • Linq to Dataset works against a DataSet that was previously created using ADO.NET. The dataset is loaded prior to using linq, so the SQL queryies are not build dynamicly.

  • Linq to EntityFramework works against entity framework context. Here the SQL queries are constructed dynamically, based on the Linq query you provided.

Obalix
+2  A: 

Linq works with the concept of queryProviders. The query provider is responsible for translating the lamba expressions into queries on the underlying data store. as Obalix said before me Linq to Entities query provider translates the linq with lambdas into real sql which is executed using underlying ado.net objects. Take a look at canonical functions here, which are translated into sql (and take notice which are not). On the other hand linq to dataset works against DAtaSet infrastructure. As you may remember Data Set has some queries associated with it. (getters, updates, deletes, inserts) with the usage of the DataAdapters objects. Linq queries are mapped onto objects that already exist in the dataset = tables, columns etc. The SQL queries are not built, because the provider does not operate at such a low level - the data set is the data abstraction it uses.

You might take a look at linq to SQL if Database agnosticism is not You concern, and there is even some provider linq to Oracle if I heard correctly.

luckyluke