I'm using SQLite.net (https://github.com/praeclarum/sqlite-net) in my Xamarin Forms project and trying to save a user's projects in the database.
In order to make sure there won't be any duplicates, I want to first clear the table by calling:
await _db.DeleteAllAsync<Project>();
This is throwing the following exception if I never saved any data in the database.
SQLite.SQLiteException: 'no such table: Project'
I realize I can do this in a try/catch
block but is there a way to clear a particular table before saving any data in it without getting exceptions in case no data has ever been saved in it before?
P.S.
I'm aware of the await _db.InsertOrReplaceAsync(List<Project>)
but when I tried that I get the following error:
System.ArgumentException: 'method arguments are incompatible'
I don't know what to make of this exception as it's pretty vague.
How do I make sure my table is clear before saving some data in it?