Friday 15 January 2010

c# - Why are the entities being eager-loaded? -


I have a unit hierarchy with multiple layers, one of which has objects in which thousands out of tens of thousands There are occasions when I only want a top-level object but I am aware that the Entity Framework is loading everything in the hierarchy.

I also have lazy loading, no profit.

 using  (var db = new MyEntities ()) {db.Configuration.ProxyCreationEnabled = true; Db.configuration.LazyLoadingEnabled = true; Var daoDict = (from db.stt_dictionary where d.id == Dictionary IDID & D. Delayed selection d) .FirstOrDefault (); }  

While debugging, if I step through this and then hover over daoDict then I think its collection properties (which virtual )

They are being loaded using a debugger to load them The debugger is not separating anything from regular code. It is calling the recipient of the property, and does so that obtains the data.

Database queries that are actually executed (either through context or through the database) to see which data is being pulled exactly how the changes which queries are being executed.


No comments:

Post a Comment