Optimistic Offline Lock
See original GitHub issueMany databases (including PostgreSQL and SQLite) don’t have an equivalent to SQL Server’s rowversion
type. We could improve our support for optimistic concurrency on those stores by implementing the Optimistic Offline Lock pattern in the framework.
This would be similar to having a rowversion
property in the entity except that EF would manage the value. When the entity is saved, somewhere in the update pipeline, we would automatically increment the property’s value. The DML would look something like this:
UPDATE Person
SET Name = "Brice", RowVersion = 24
WHERE RowVersion = 23;
Issue Analytics
- State:
- Created 8 years ago
- Reactions:30
- Comments:10 (7 by maintainers)
Top Results From Across the Web
P of EAA: Optimistic Offline Lock - Martin Fowler
Optimistic Offline Lock. by David Rice. Prevents conflicts between concurrent business transactions by detecting a conflict and rolling back the transaction ...
Read more >Offline Concurrency Control
Optimistic offline locking is a technique that detects when there is a conflict between two concurrent business transactions and performs a ...
Read more >Optimistic vs. Pessimistic locking
Pessimistic Locking is when you lock the record for your exclusive use until you have finished with it. It has much better integrity...
Read more >Optimistic concurrency control
Optimistic concurrency control (OCC), also known as optimistic locking, is a concurrency control method applied to transactional systems such as relational ...
Read more >Chapter 16. Offline Concurrency Patterns
Optimistic Offline Lock. by David Rice. Prevents conflicts between concurrent business transactions by detecting a conflict and rolling back the transaction.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@m4rs2k Yes, 👍 this issue.
FYI I found out PostgreSQL does have an automatically-updated xmin column which could be used as a concurrency token, much like SqlServer’s rowversion, so this may be less important for PostgreSQL. See https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/19.