Entity Framework Extensions Out of Memory
You execute a method from the Entity Framework Extensions library, and the following error is thrown:
An exception of type
That error is caused when the library consumes too much memory.
Most of the time, this error is caused by some methods used from
Entity Framework for command generations that will be used later by our library.
Turning off Entity Framework Propagation
This solution work with around 99% of models. By turning off this options, our library doesn't longer use several methods from Entity Framework that consume high memory such as the command generation.
In some exceptional scenario, using Bulk Operations such as:
may a better idea. They are faster and consume way less memory than BulkSaveChanges.
Reduce the number of entities in the ChangeTracker
Another way is to make sure the ChangeTracker doesn't contain too many entities.
The ChangeTracker has not been build to support millions of entities.