This code's syntax is accepted:
public async Task UpdateLocationAsync(SOs_Locations locations)
{
var db = new SQLiteAsyncConnection(SQLitePath);
await db.UpdateAsync(locations);
}
...but I don't grok how the SQLite engine knows which record to update when it is simply passed the class instance. Is it the case that the SQLite or SQLite-net engine peeks at the ID value and behind the scenes does a (in SQLese):
UPDATE SOs_Locations
Set Bla = Bla, etc.
WHERE ID = locations.Id
?
That's exactly what it does. You can check the source of the method here:
var q = string.Format ("update \"{0}\" set {1} where {2} = ? ", map.TableName, string.Join (",", (from c in cols
select "\"" + c.Name + "\" = ? ").ToArray ()), pk.Name);
Of course you can always execute your own SQL if you need more control:
db.ExecuteAsync("UPDATE SOs_Locations Set Bla = ?, WHERE ID = ?", bla, id);