A first chance exception of type 'Devart.Data.Linq.ChangeConflictException'

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
codeprime
Posts: 3
Joined: Wed 03 Oct 2012 13:28

A first chance exception of type 'Devart.Data.Linq.ChangeConflictException'

Post by codeprime » Wed 03 Oct 2012 13:32

A first chance exception of type 'Devart.Data.Linq.ChangeConflictException' occurred in Devart.Data.Linq.dll
UPDATE mydatabase.imagefile SET Image = :p1 WHERE idImageFile = :key1
-- p1: Input Blob (Size = 74077; DbType = Binary) [System.Byte[]]
-- key1: Input Int (Size = 0; DbType = Int32) [1296]
-- Context: Devart.Data.MySql.Linq.Provider.MySqlDataProvider Model: MetaModel Build: 4.1.82.0

idImageFile it's the PK
Image it's not null

Any ideas?
Thanks

codeprime
Posts: 3
Joined: Wed 03 Oct 2012 13:28

Re: A first chance exception of type 'Devart.Data.Linq.ChangeConflictException'

Post by codeprime » Wed 03 Oct 2012 13:52

This happens when I'm updating the Image column with the same byte[], could this be a bug?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: A first chance exception of type 'Devart.Data.Linq.ChangeConflictException'

Post by MariiaI » Thu 04 Oct 2012 13:15

This is a known issue. It occurs because you are trying to update the record with the same value. The Update command is sent to the server, but, since the old and new values are the same, the number of rows affected by the last UPDATE is equal to 0, and LinqConnect runtime considers this to be a concurrency conflict.

To avoid it, please set the Found Rows parameter to 'true' in the connection string in use (open Database Explorer->Edit Connection Properties-> Advanced) and save the changes. In this case, the number of rows matching the WHERE condition of the UPDATE statement will be returned by the provider.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: A first chance exception of type 'Devart.Data.Linq.ChangeConflictException'

Post by MariiaI » Fri 07 Jun 2013 12:15

Devart.Data.Linq.Binary type was added to the "Type Mapping Rule Editor" for working with binary columns. We recommend you to change the default mapping before creating a LinqConnect model via the Database-First approach in order to apply these changes to all properties of the model.
To do it:
- open Tools -> Entity Developer -> Options -> Server Options -> MySQL;
- set the .NET type to 'Devart.Data.Linq.Binary' for the Server Type 'varbinary';
- press 'OK' to save the changes.

Please test the new build of LinqConnect 4.2.262 with this change and notify us about the results.
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=27292

Post Reply