0

EF has built-in support for optimistic concurrency (http://msdn.microsoft.com/en-us/data/jj592904.aspx). In this case, I want to leverage that capability, but I don't want the "before" object to be what I just pulled from the database. Instead, I want it to be something I pulled a while ago (and stored the rowversion value of).

Is it possible to "fake" the object for that purpose?

The use case is a webpage that shows some data. When the user saves the form, I want to check that no other users have already saved the data...

Scott Stafford
  • 43,764
  • 28
  • 129
  • 177
  • so the concurrency check throws an error. You still have the POCO version as maintained by front-end. No need to reload. I dont see the issue. – phil soady Jul 30 '13 at 14:04
  • I can compare the new version to the old version manually and then throw an error, but I guess I was hoping to hook into the automatic EF mechanism for doing it... – Scott Stafford Jul 30 '13 at 15:59
  • yes ef Does it for you using Rowversion. It will do optimistic check and throw an error. The generated SQL will have an extra WHERE Rowversion = Rowversion. If the record was changed, this update fails. So im not sure what you mean by manually check. Its not necessary IF the POCO has rowversion/timestamp defined – phil soady Jul 30 '13 at 16:04

0 Answers0