Why do a small amount of add/deletes take several seconds in EF4?
- by TomWij
Using the Entity Framework 4. I have created a Code First database in the past and a piece of code needs to delete and add 16 objects, this takes 6 seconds each. That's 300+ ms for each query!
The deletes/adds occur in a foreach scope and there is a SaveChanges() outside the foreach.
In the above image you see that each takes 6 seconds, which is 34% of the time, for 16 calls.
That doesn't sound normal to me... Why is this and how can I improve the performance?
If there is no solution: Are there any workarounds I can use? It would be a pain to rewrite my project...