Dapper
Dapper copied to clipboard
SQLite, Wrong bool conversion
Column type is BOOLEAN. SQLiteConnection class return value "True" but Dapper cannot convert it to a bool value. Please fix this.
Hi,
Checked with Dapper 2.0.143 and System.Data.SQLite 4.2.2. Works as expected.
using System.Data.SQLite;
using Dapper;
var connection = new SQLiteConnection("Data Source=:memory:;Version=3;New=True;");
connection.Open();
// Init
await connection.ExecuteAsync(@"create table test (id int, bool_field boolean)");
await connection.ExecuteAsync(@"insert into test (id, bool_field) values (1, 1), (2, 0)");
// Assert
foreach (var val1 in await connection.QueryAsync<bool>("select bool_field from test"))
{
Console.WriteLine($"{val1}");
}
connection.Close();
/* Console output
True
False
*/
I find SQLite only in version 1.0.118
Where you find 4.2.2 ?
But it seems to work.
You're right. I used version 1.0.118. 4.2.2 is the version of Dapper.Extensions.SQLite.