1

DataContext/Entity Model 总是从数据库中读取数据。DataContext/Entity Model 有什么方法可以从 DataSet 中读取数据。

谢谢

4

2 回答 2

0

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.

于 2009-12-28T09:51:13.073 回答
0

查看Linq-to-DataSet

LINQ to DataSet 使查询缓存在 DataSet 对象中的数据变得更加容易和快捷。具体来说,LINQ to DataSet 通过使开发人员能够从编程语言本身编写查询,而不是使用单独的查询语言来简化查询。

于 2009-12-28T07:54:17.733 回答