Commit 4e738fd
In this code:
The transaction is started using _dbContext.Database.BeginTransaction().
The product is queried and locked for update using saveChanges().
The stock quantity is checked and updated within the transaction.
The transaction is committed after the order is created.
This ensures that the stock check and update are performed atomically, preventing race conditions.1 parent 9e52db0 commit 4e738fd
File tree
1 file changed
+162
-175
lines changed- src/Modules/SimplCommerce.Module.Orders/Services
1 file changed
+162
-175
lines changed
0 commit comments