Concurrency Handling in Entity Framework Core with Transactions and Master Data
We have two tables:
Orders (transaction table): Stores order details and references a customer using CustomerID.
Customers (master table): Stores customer information.
The Orders table has a RowVersion column for optimistic locking.
The Customers table lacks a RowVersion column.
The Problem:
If a user modifies customer data concurrently while another user creates an order referencing that customer, the following might occur:
The order creation succeeds, but it references outdated customer information, leading to data inconsistency or exception.
The Question:
How does latest Entity Framework .net core handle concurrency in this scenario?
What are best practices and strategies to address this issue?