Caching EF data in memory

I’m wondering if anyone can tell me when EF data is retrieved and cached in memory given the following code:

var students = dbcontext.students; MemoryCache.Default.Add(“AllStudents”,students);

Given that students is a proxy object and lazy loaded, will the data be retrieved immediately and put into memory? Or only when I pull it put of the cache? Is this generally a bad idea? Should I be calling .Load() or using non EF objects?

submitted by /u/ToeGuitar
[link] [comments]

Leave a Reply