We have seen how to configure concurrency tokens and the errors it throws whenever there is a concurrency conflict. In this section, we will discuss different approaches available for handling concurrency conflicts.
The preceding configuration will let EF Core consider the ModifiedAt
column as the concurrency check column, and any further update to this column will restrict users from performing parallel updates.
We have seen the approaches available for handling conflicts, let's discuss them in detail.
The optimistic concurrency will let the user try to update the entity. EF handles the overhead operations to ensure whether there is any concurrency conflict or not. This operation does not hurt performance, as pessimistic concurrency hurts, but it does handle concurrency in different ways.
The different approaches for handling optimistic concurrency are:
- Database wins
- Client wins
- User-specific custom resolution
We will be investigating...