views:

50

answers:

2

DataContext/Entity Model always read data from Database. is there any way DataContext/Entity Model will read the data from DataSet.

Thanks

A: 

Check out Linq-to-DataSet

LINQ to DataSet makes it easier and faster to query over data cached in a DataSet object. Specifically, LINQ to DataSet simplifies querying by enabling developers to write queries from the programming language itself, instead of by using a separate query language.

marc_s
A: 

There is no automated way to make LinqToSql or the EntityFramework read data from a DataSet instead of from a Database. Using a DataSet as some kind of "disconnected database" is fine for a single UnitOfWork, if you want to use it as some kind of datastore in disconnected scenarios you should consider another solution such as SQL Server CE (which you can't use with L2S but with EF).

If your scenario resembles the first one (single Unit of Work) you need to fill the data manually into the dataset and can then use Linq-To-DataSet consecutively.

Johannes Rudolph