Concurrent delete and put

35 views
Skip to first unread message

Asger Hallas

unread,
May 13, 2012, 2:14:44 PM5/13/12
to rav...@googlegroups.com
Hi,

I have a scenario where it's possible to have two processes delete and update an entity at the same time. 

Is there a way to ensure that, if an entity is deleted in the first process, it will not be reinserted upon SaveChanges() in the second process?

I would have thought that it would throw a ConcurrencyException in this situation, but despite several experiments, I can't make it do so :)

//Asger

Itamar Syn-Hershko

unread,
May 13, 2012, 2:29:39 PM5/13/12
to rav...@googlegroups.com
Instead of deleting mark it as deleted, this way Optimistic Concurrency will just work for you

Asger Hallas

unread,
May 14, 2012, 7:22:12 AM5/14/12
to rav...@googlegroups.com
Thanks for the quick reply! That makes sense. 

In my scenario the entities are sagas so there will eventually be lots and lots of documents marked as deleted. I guess that could become a problem. 

I wonder what the thoughts are behind letting a PUT succeed, when the entity does not exist in the database and the etag in the PUT commands i not Guid.Empty (when using optimistic concurrency = true of course)?

Oren Eini (Ayende Rahien)

unread,
May 14, 2012, 10:01:27 AM5/14/12
to rav...@googlegroups.com
I think it is a bug, I'll fix this.
Reply all
Reply to author
Forward
0 new messages