Entity framework Optimistic Concurrency Exception

concurrency entity-framework

Question

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; }
1
7
9/21/2013 8:19:24 AM

Accepted Answer

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

11
4/19/2015 2:31:05 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow