ConcurrencyException not being thrown using Entity Framework
Posted: Mon 11 Apr 2011 19:38
I am using Entity Framework 4.0 and have unit tests to assure that concurreny exceptions are thrown. I was using a different provider for SQLite and the concurrency tests worked. Now they don't. I have played with all the settings for the connection.
The test goes like this. Open a ObjectContext (connection), its wrapped by a repository, Read some data. Next create a new ObjectContext and read and update the data. Next update the data from the first context and save it. It is at this point the concurrency exception should be thrown, but it does not happen. I have verified that the timestamps are different for the two instances of data before the second update is occurred and I have verified that the timestamp field is a computed field and concurrency is fixed.
If anyone has this working or even better can provide a code example where they have it working I would be highly appreciative.
The test goes like this. Open a ObjectContext (connection), its wrapped by a repository, Read some data. Next create a new ObjectContext and read and update the data. Next update the data from the first context and save it. It is at this point the concurrency exception should be thrown, but it does not happen. I have verified that the timestamps are different for the two instances of data before the second update is occurred and I have verified that the timestamp field is a computed field and concurrency is fixed.
If anyone has this working or even better can provide a code example where they have it working I would be highly appreciative.