We differ between two common solutions: Optimistic concurrency handling and Pessimistic concurrency handling.
Optimistic concurrency uses a special column in the table to track if the record was changed.
Entity framework has direct support for Optimistic concurrency in both Object Context API (also shows required mapping in EDMX) and in Db Context API.
Code first supports mapping in both data annotations and fluent API.
The article will also provide a real solution for pessimistic concurrency which requires usage of native SQL.
This area of database access implementation is in general referred as concurrency.Here is where the adaptation of the walkthrough begins.As Brice noted in his post, Npgsql currently doesn't support database creation.After reading the excellent article about entity framework on Postgresql by Brice Lambson, I decided to write this post to document my experience playing with Entity Framework 4.3.1 and Npgsql.This post will be an adaptation of the Code First To a New Database walkthrough in order to make it work with Npgsql.As pointed out by Brice in his answer to a user question about this error, you have to tell Entity Framework to use a different schema.