我是新来的.NET实体框架,并试图遍历数百万行的表中的记录。以下是基本代码:实体框架查询outofmemoryexception
// select the records from the database
var records = from data in dataContext.Messages
select data;
// iterate over the messages
foreach (var record in records)
{
// do nothing
}
在遍历数据时,我得到'outofmemoryexception'。有什么方法可以改变我的查询或管理ObjectQuery实例的内存吗?
你在那个迭代里面做了什么? – Tigran
[实体框架大型数据集,内存不足异常]的可能重复(http://stackoverflow.com/questions/18169859/entity-framework-large-data-set-out-of-memory-exception) –