SaveChanges
The DbContext method that writes all tracked inserts, updates and deletes to the database in one transaction.
In more detail
It inspects the change tracker and sends one command per insert, update or delete. Await SaveChangesAsync and pass the request's cancellation token.
Related terms
- change tracking — EF Core keeping a snapshot of entities it loaded so that SaveChanges can detect which properties changed and send updates for them.
- unit of work — A pattern that collects the changes made during one business operation and commits them together, or not at all.
- transaction — A group of database changes that succeed or fail together, so the data is never left half-updated.
Taught in
- Querying, Change Tracking, and Saving Data — Modern .NET Core, C# & Enterprise Microservices
- The Repository Pattern — Modern .NET Core, C# & Enterprise Microservices