7

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 Answer 1

11

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

Sign up to request clarification or add additional context in comments.

2 Comments

Can you say the must be needed situation for handle concurrency issues (I mean some examples)?
Yes you must use either [TimeStamp] or [ConcurrencyCheck]. Then you need to decide how would you deal with Concurrency. Warn user? Reload from database and merge? I've added a tutorial in post for you which has extensive explanation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.