dotConnect seems to fail with Dapper ORM.

dotConnect seems to fail with Dapper ORM.

Postby 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.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?
Posts: 1
Joined: Fri 22 Jul 2016 21:26

Re: dotConnect seems to fail with Dapper ORM.

Postby 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).
Devart Team
Posts: 7391
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for MySQL