I’d like to know what happens given the following scenario using the .net client.
using (IDocumentSession session = documentStore.OpenSession())
{
thingToUpdate = session.Load<TUpdateThing>(id);
// Modify thingToUpdate here
// ** Someplace else the object is updated and saved. **
session.SaveChanges(); // What happens here?
}
Will this automatically throw an error based on the etag having changed, or will this go off and overwrite the changes made by somebody else?
I’ve seen some stuff on this in relation to the http api:
http://ravendb.net/docs/http-api/http-api-comcurrency
What you’re talking about is optimistic concurrency. If you want to use that, you set
By default, it’s not set.
Here’s a passing test that demonstrates this: