I get the following Exception
System.InvalidCastException: 'Object must implement IConvertible.'
on line 2, or any line after the start of the function.
public int SaveItem<T>(T item) where T : IBusinessEntity, new() {
if (database.Table<T>().FirstOrDefault(x => x.ID == item.ID) != null)
{
database.Update(item);
return item.ID.Value;
}
else
{
return database.Insert(item);
}
}
Its being called by
public void SaveCategory(Category c){
db.SaveItem<Category>(c);
}
The Function has been used for the last 3 years without a problem but when I recently had to update some NuGet Packages (namely SQLite PCL) it stopped working. Im at my wits end.