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.
ConcurrencyException not being thrown using Entity Framework
I need to clarify something for you. My timestamp is actually a long not a datetime. I just want to tell you this because your bug may not be related to just datetime.
Here is the update trigger I am using to create the “timestamp”.
CREATE TRIGGER TableNameTimestamp
AFTER UPDATE/INSERT
ON TableName
BEGIN
Update Table
Set TimeStampColumn = cast(replace(strftime('%f%M%H', 'now'),'.','') as integer)
Where Id = NEW.Id;
Select RAISE(IGNORE);
END;
Here is the update trigger I am using to create the “timestamp”.
CREATE TRIGGER TableNameTimestamp
AFTER UPDATE/INSERT
ON TableName
BEGIN
Update Table
Set TimeStampColumn = cast(replace(strftime('%f%M%H', 'now'),'.','') as integer)
Where Id = NEW.Id;
Select RAISE(IGNORE);
END;
New build of dotConnect for SQLite 3.30.202 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/sqlite/download.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=21730 .
It can be downloaded from http://www.devart.com/dotconnect/sqlite/download.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=21730 .