question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimistic Offline Lock

See original GitHub issue

Many 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:open
  • Created 8 years ago
  • Reactions:30
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
ajcvickerscommented, Aug 19, 2021

@m4rs2k Yes, 👍 this issue.

2reactions
rojicommented, Apr 29, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found