0
我试图了解实体框架乐观并发,我无法改写了最新的一个变化。请看看代码。保存更改,尽管DbUpdateConcurrencyException
var x = a.users.Where<users>(s => s.id == 4).First<users>();
x.name = "xxxx";
try{
a.SaveChanges();
}
catch(DbUpdateConcurrencyException ex){
message("Overwrite other changes ? yes or no");
if(yes){
// overwrite the entity values with mine in the db
}
}
基本上当记录得到了由其他用户更新,管理员会看变化,他必须覆盖旧值。我怎么做?任何帮助是极大的赞赏。