I'm using SQLite in my project and to connect to DB I use sqlite-net library. I have created a model:
internal class Product
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
...
public bool IsDefault { get; set; }
}
There are a few records in database - some have IsDefault column value set to true, some to false. However, when I try to query records like this:
var result = dc.Table<Product>().ToArray();
every record has IsDefault set to false. Inserting a record works fine, but querying it do not.
When I changed column type to bool? in model, it returns null.
EDIT---- What is weird is when I execute query
var t = dc.Table<Product>().Where(i => i.IsDefault == true).ToArray();
It returns me correct number of records, but even so every item of array has IsDefault set to false.