c# - Entity Framework 5 System.OutOfMemoryException simple select query on large table using Take() -


i using entity framework 5 simple agent running on windows 2008. db has large amount of records (over few millions).

while fetching few records in db system.outofmemoryexception: exception of type 'system.outofmemoryexception' thrown. looking @ server there dozens of gb of memory available (so def not hardware limitation) , process ends when reaching ~1800mb. query quite simple (i testing if datetime flag null) , take using parameter 20.

(x => x.myfalg.hasvalue == false ).take(psamplesize); 

why ef load more records 20 here. shouldn't take restrict quantity of data loaded?

note : our context using these 2 params @ init.

this.dbcontext.configuration.lazyloadingenabled = true; this.dbcontext.configuration.autodetectchangesenabled = false; 


Comments