This operation will update the correct row, but will also create a duplicate of that row. How do I prevent this behavior ?
public bool Update(UserModel entity)
{
using (var db = new LiteDatabase(_connectionString))
{
var col = db.GetCollection<UserModel>();
var result = col.Update(entity);
return result;
}
}
For reference, UserModel looks like this :
public class UserModel
{
[BsonId]
public int Id { get; set; }
public string? UserName { get; set; }
/* Some more fields without annotations*/
}
I’ve tried with and without the [BsonId]
annotation.