I\'m working with Entity Framework (Model First approach) against a PostgreSQL 9.1 database.
You probably all know that every table has a hidden column called
xmin
is quite unlikely to go away any time soon, and can be used to implement a simple form of optimistic concurrency control for updates. Be careful in that internally it is an unsigned 32-bit number, so don't try to store it in a signed 32-bit field, or it is likely to work for a while and then break badly.
As long as you map it to an appropriate data type, read it in up front, include it in the WHERE
clause of your UPDATE
and take appropriate action on a "not found" condition it is pretty straightforward.