Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Closed Unassigned: Idea for speeding up checking for changes when not using proxies [1451]

$
0
0
In some situations we have a context which builds up a large number of entities that are never used (see #1450 for one example but there are others). I'm not sure if this is technically possible or if it would actually be efficient to do this, but I was wondering whether it would be possible to clean up the entity list in the change tracker as we detect changes. The idea is that any entity which has no changes and no other references to it apart from the change tracker would be removed from the change tracker (and therefore GC would just collect it eventually).

Admittedly, this would mean that the entity wasn't available to save loading it from the database again (not sure if the context does this or not). The other solution would be that instead of removing it completely, to just flag it as having no other references and then if it is accessed for anything to remove that flag (since nothing else should be able to access it from outside the context).

The big problem with this whole idea of course is whether it is possible to determine if there are any other references outside the change tracker and if it is possible, whether it is efficient. I imagine that it is possible since GC can identify when objects can be cleaned up, but I'm not familiar with GC internals.
Comments: __EF Team Triage:__ This isn't a behavior we would want to adopt because users are free to edit any of the attached entities at any stage and save. There are also many programming patterns where you wouldn't have a reference to an entity but would retrieve it directly from the context.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>