Closed maxtoroq closed 6 years ago
SqlTable uses the new key in the update predicate instead of the old key. Since there's no change tracking, a new overload is required.
A workaround that I'd recommend only for single column keys is the following:
SqlBuilder updateSql = db.Table<Entity>() .CommandBuilder .BuildUpdateStatementForEntity(entity); updateSql.ParameterValues[updateSql.ParameterValues.Count - 1] = oldId; db.Execute(updateSql, affect: 1, exact: true);
Shipped in v6.1.0
Added new SqlTable.Update overload, e.g.:
SqlTable.Update
db.Table<Entity>.Update(entity, oldId);
SqlTable uses the new key in the update predicate instead of the old key. Since there's no change tracking, a new overload is required.
A workaround that I'd recommend only for single column keys is the following: