SQLite.Net-PCL
SQLite.Net-PCL copied to clipboard
SQLite.Net.SQLiteException: near "where": syntax error when updating table with only keys
I have this table with only a id key and child objects (no direct data):
[Table("Categories")]
public class Category
{
[PrimaryKey]
public int Id { get; set;}
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<CategorySign> Signs { get; set;}
}
And I get a crash when calling database.Update(category) :
SQLite.Net.SQLiteException: near "where": syntax error
It took me a long time to find out that the problem was that there is no other member. If I add a dummy column, like : public int Something { get; set; }
then the crash doesn't occur anymore.
lol the error still exists today. Thanks for the hint.
Same for me - this produces error:
[Table(nameof(MyModel))]
public class MyModel
{
[PrimaryKey]
public string MyModelId { get; set; }
}
Adding dummy additional property is "workarouding" this issue:
[Table(nameof(MyModel))]
public class MyModel
{
[PrimaryKey]
public string MyModelId { get; set; }
public string SomethingAdditional { get; set; }
}
Thanks for the hint! 👍