Multiple Deletion Bug When Table has timestamp

Multiple Deletion Bug When Table has timestamp

Postby lc4pro » Wed 02 Oct 2013 01:56


I'm using dotConnect Version.
I'm facing a problem when deleting multiple rows from the table having timestamp.
It's not throwing any exception, just delete the first one and finish.
I just realized if the record's timestamp are all same, it delete all. I'm not sure why it's checking the timestamp of one row with all the rest.

If I make timestamp's IsVersion off, it works. but I need timestamp to track changes.

can you help?
Posts: 51
Joined: Thu 12 Jul 2012 08:16

Re: Multiple Deletion Bug When Table has timestamp

Postby MariiaI » Wed 02 Oct 2013 10:56

It seems that you mark the version property (e.g., "VersionProp") as an entity key (IsPrimaryKey = true, IsVersion = true). In this case, when deleting the row, two conditions will be checked - the value of the version column and the value of the primary key.
Due to the fact, that the "VersionProp" column may contain the same values in the database, several rows will be deleted. You could check it via logging the generated SQL.
If your database table doesn't have a primary key, you could mark any property of your entity class as an Entity key, but do not mark the "VersionProp" property as an Entity Key to avoid such situation with multiple deletes.

For more information:
In case when entity classes don't have an entity key, they are not recognized as entities. Such entities can still be queried, but aren't cached, and change tracking is not enabled for them. LinqConnect does not allow modifications of such entities - an exception is raised when such entity is created or deleted, and updates of such entity are ignored.
To avoid this situation, you could mark any property of entity class as an Entity key and re-generate the code. Please refer here

Please tell us if this helps.
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Return to dotConnect for MySQL