I'm getting a ChangeConflictException
in my web application when the code updates a certain row within a certain table. The best I can tell it seems as though two users are completing the transaction at the same exact time and optimistic concurrency only affect the SubmitChanges()
method instead of doing the lock when the row is selected.
So in other words I have a transaction like this:
Dim query = From row in Table _
Where row.ID = <blah> _
Select row
Dim result = query.Single()
result.COLUMN = 2
dataContext.SubmitChanges()
The built-in optimistic concurrency locks the record when SubmitChanges()
is called but if the record is changed after Single()
and before SubmitChanges()
then an error is thrown.
...at least that's my theory...
Does anyone know of a way to start the lock at the Single()
call instead of just at SubmitChanges()
?