Explain Concurrency Tokens and how to handle concurrency conflicts.

Updated Apr 28, 2026

Short answer

Concurrency tokens prevent lost updates by ensuring data hasn't changed since it was queried. If changed, EF throws a DbUpdateConcurrencyException.

Deep explanation

When a property is marked as a concurrency token (often a row version/timestamp), EF Core includes it in the WHERE clause of UPDATE/DELETE statements. If the row version in the DB differs from the tracked entity, 0 rows are affected, triggering the exception. You must catch it and implement a resolution strategy (client wins, database wins, or merge).

Real-world example

Two admins edit the same user profile simultaneously. Admin B clicks save after Admin A. Admin B gets an error instead of silently overwriting Admin A's changes.

Common mistakes

  • Catching the exception but doing nothing, failing to resolve the conflict and leaving the application state broken.

Follow-up questions

  • Can standard properties be concurrency tokens?

More Entity Framework interview questions

View all →