We use LINQ
in our ASP .NET
application to run database queries and commands. We have been having concurrency issues on updates to tables in which we update the value of a Date
field. More specifically, if two users click a button at the exact same time and the code attempts to update a Date
field in the database then the built-in optimistic concurrency fails to do its job and one the users throws an exception.
Here's the weird part, if we go into the DBML
and set the field's time stamp
property to true and run the unit tests it works just fine...no explicit locks needed.
We would like to understand this a bit more before implementing this throughout the entire system. Does anyone have some understanding as to why this works?