Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dapper mapping MySql BIT(1) data type to ulong instead of boolean

Tags:

.net

mysql

dapper

Please has anyone come across the above situation with Dapper and MySQL. In all my tables in MySQL (5.1), where the data type is BIT(1) or BIT, Dapper simply return such field as ulong (UInt64). I am using MySql.Data.MySqlClient and I have no such issue with EF which is what I am trying to convert from.

Thanks for any help.

like image 264
Gboyega Sulaiman Avatar asked Jul 16 '11 13:07

Gboyega Sulaiman


1 Answers

In MySQL, the type Boolean is mapped to Tinyint(1) with MySQL. Perhaps you will have to cast it to Boolean (0=false/1=true), Convert.toBoolean(UInt64) may help you (see http://msdn.microsoft.com/en-us/library/33f2zy48.aspx).

@Christian Droulers: The behaviour of SQLite is similar.

like image 120
Christoph Mühlmann Avatar answered Sep 21 '22 09:09

Christoph Mühlmann