This may be a simple or rapidly asked question.
In my EF application I am getting an exception.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
I am trying to retrieve records form Log table based on the idList (int) . Logs table has millions of records. How to fix this exception or how to optimize the code to solve this?
var resultList = idList.Join(clientEntities.Logs,
x => x,
s => s.ID,
(x, s) => s)
foreach (var r in resultList)
{
...
}
Exception was thrown while executing the loop.
我认为最好的选择是使用分页。您可以通过使用分页来限制记录。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.