handling concurrency conflicts

handling concurrent deletes

When a concurrent delete of a database row is detected, EF Core throws a DbUpdateConcurrencyException exception. Handle this exception to handle the conflict.

handling concurrent updates

A concurrent update of a database row can be detected. This requires a Timestamp property with attribute:

[Timestamp]
public byte[]? Timestamp { get; set; }

Then, add a migration and update the database:

PM> Add-Migration AddTimestamp
PM> update-database