I have the following update code in the ASP.NET MVC controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Person(int id, FormCollection form)
{
var ctx = new DB_Entities(); // ObjectContext
var person = ctx.Persons.Where(s => s.Id == id).FirstOrDefault();
TryUpdateModel(person, form.ToValueProvider());
ctx.SaveChanges();
return RedirectToAction("Person", id);
}
However, this update code is Last-Writer-Wins. Now I want to add some concurrency control. The Person table already has the SQL timestamp column. Do I have to send the timestamp value to the client as the hidden value and process it manually in the post back? Or is there a a standard pattern in Entity Framework to do this?
Thanks.