Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity framework Optimistic Concurrency Exception

Should I maintain a Timestamp property on my Model classes for enable optimistic concurrency for data update and delete ? If I won't use such a attribute,whether EF will give concurrency exception at run time or not ?

Is this must for enable the concurrency handling ?

[Timestamp]
public byte[] RowVersion { get; set; }
like image 316
Sampath Avatar asked Sep 21 '13 08:09

Sampath


1 Answers

Yes, either that or you decorate a property with [ConcurencyCheck]. Otherwise you will end up with scenario last write wins.

EDIT:

Official tutorial on how to handle Concurrency:

Handling Concurrency with the Entity Framework in an ASP.NET MVC Application

like image 184
Admir Tuzović Avatar answered Sep 20 '22 16:09

Admir Tuzović