dotConnect seems to fail with Dapper ORM.

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
vdemille
Posts: 1
Joined: Fri 22 Jul 2016 21:26

dotConnect seems to fail with Dapper ORM.

Post by vdemille » Fri 22 Jul 2016 21:32

Was using Sql Server with Dapper to do basic data crud. After switch to dotConnect and mysql the syntax is failing. I'm executing the following code which used to work:

Code: Select all

using (var MySqlConnection = new MySqlConnection(IndexConnectionString))
{
   RootBucket newBucket = new RootBucket
   {
      Id = name.GetHashCode(),
      Name = name
   };
   MySqlConnection.Open();
   MySqlConnection.Execute("INSERT IndexerRootBucket(Id, Name) VALUES (@Id, @Name);", newBucket);

   return newBucket;
}
It now gives the thrown exception:
Exception thrown: 'Devart.Data.MySql.MySqlException' in Devart.Data.dll
Additional information: Column 'Id' cannot be null

Do I need to do something different to make this work, or is it unsupported in dotConnect?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: dotConnect seems to fail with Dapper ORM.

Post by Shalex » Tue 26 Jul 2016 14:55

Looks like Dapper expects Id to be generated on the server side, but it is actually not AUTO_INCREMENT.

If this information doesn't help, please send us a small test project with the corresponding DDL script. In case of >2MB attachment, we recommend either using some file exchange server (send us the corresponding link) or uploading a test project to our FTP server (the credentials will be provided by email request).

Post Reply