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#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 82,146 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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.