</> realdeveloper

Transactions and consistent data

A transaction commits a group of database changes together or rolls them back. When supported by the provider, EF Core applies a single SaveChanges call transactionally. Design boundaries explicitly for multiple calls.

A concrete example

Reducing stock and creating an order should succeed together. A database transaction cannot undo an external payment; external effects need retry safety and compensation.

BEGIN → update stock → insert order → COMMIT

Explain it yourself

What constraints and concurrency checks protect the last item from two buyers?

How to study this

Write your reasoning first. Check the original documentation, identify an assumption, then try a different example. Reading this page does not count as verified skill evidence.

Source and review

Microsoft EF Core transactions ↗

Original RealDeveloper explanation; last source check: .

Put it into practice

Public pages are open to everyone. Sign in to save answers and follow a personal practice route.

Open practice topics →