With System.Data.SQLite and LINQ to Entities, I'm unable to do a simple update.
This code
using (Entities context = new Entities()) {
var Obj = context.MyTable.Where(m => m.Title.StartsWith("Alaska")).FirstOrDefault();
Obj.Artist = "A";
context.SaveChanges();
}
Throws this exception
A first chance exception of type 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException' occurred in EntityFramework.dll
Additional information: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
How can I fix this?
I'm in an isolated test project so there's nothing else going on around it.
Aucun commentaire:
Enregistrer un commentaire