ASP.NET Core & Web API (50 Qs)•Part 2: Entity Framework Core, Security & High-Performance Data (11 - 24)
What is the difference between Optimistic Concurrency and RowVersion in EF Core?
senior LevelFormsPerformanceSecurity & Auth
In Simple Words:
- Uses a
[Timestamp]orIsRowVersion()byte array column. - SQL Server automatically increments the
RowVersionbinary on every update. - EF Core adds
WHERE RowVersion = @originalVersion. If another transaction modified the row, aDbUpdateConcurrencyExceptionis thrown.