Working with Transactions
Learn about transactions in EF Core and their role in maintaining database integrity and ensuring the ACID properties.
Transaction in EF Core
Every time we call the SaveChanges
method, an implicit transaction is started so that if something goes wrong, it will automatically roll back all the changes. If the multiple changes within the transaction succeed, the transaction and all changes are committed.
Role of transaction
Transactions maintain the integrity of our database by applying locks to prevent reads and writes while a sequence of changes occurs.
ACID properties
Transactions are ACID, which is an acronym explained in the following list:
Press + to interact
A is for atomic: Either all the operations in the transaction commit or none of them do. ...