我是新來的.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) –