Huge Memory Issue in Entity framework Load Method

Indudhar Gowda 426 Reputation points
2022-05-04T17:07:33.027+00:00
 this.Context.TestPRepetitions.Where(tp => sampleCodes.Contains(tp.SampleCode))  
                .Include(tp => tp.ReportableResults)  
                .Load();  
  
 this.Context.Recognitions.Where(rec => reportableResultIds.Contains(rec.ReportableResultId)).Load();  

Recognitions Table has 6352014 Rows

@AgaveJoe this what the Actual Method Does...

Developer technologies .NET Other
SQL Server Other
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-05-04T21:21:01.43+00:00

    Don’t use Load(). It’s whole point is to load all the rows into memory, and uses lots of memory.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.