BulkSaveChanges method is the upgraded version of
All changes made in the context are persisted in the database but way faster by reducing the number of database round-trip required!
BulkSaveChanges supports everything:
- Association (One to One, One to Many, Many to Many, etc.)
- Complex Type
- Inheritance (TPC, TPH, TPT)
- Navigation Property
ChangeTracker to detect and persist change automatically is great! However, it leads very fast to some problem when multiples entities need to be saved.
SaveChanges method makes a database round-trip for every change. So if you need to insert 10000 entities, then 10000 database round-trip will be performed which is INSANELY slow.
BulkSaveChanges works exactly like
SaveChanges but reduces the number of database round-trips required to greatly help to improve the performance.
|Operations||1,000 Entities||2,000 Entities||5,000 Entities|
|SaveChanges||1,000 ms||2,000 ms||5,000 ms|
|BulkSaveChanges||90 ms||150 ms||350 ms|