Mobile Friendly with code
Definition
BulkSaveChanges method is the upgraded version of SaveChanges
.
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
- Enum
- Inheritance (TPC, TPH, TPT)
- Navigation Property
- Self-Hierarchy
- Etc.
context.Customers.AddRange(listToAdd); // add context.Customers.RemoveRange(listToRemove); // remove listToModify.ForEach(x => x.DateModified = DateTime.Now); // modify // Easy to use context.BulkSaveChanges(); // Easy to customize context.BulkSaveChanges(bulk => bulk.BatchSize = 100);