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

New Post: Performance issues

$
0
0

If you didn't want to simulate a web sever scenario where you have a new context per request, you could also move SaveChanges out of the loop. did this in a Seed method, that inserted a few thousand test entities with many references.

One call to SaveChanges in every iteration (like in your test code) or only one at the end can be very slow, but calling SaveChanges every 100 iterations gave me much better performance (from 10 minutes to 42 seconds). I'm not sure if this applies to entities without any references, too...


Viewing all articles
Browse latest Browse all 10318

Trending Articles



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