Hello Im using VS 2012 Entity Framework 6.0.0 beta and .net 4.5
In my DBLayer I want to update an entity I tryed following:
using (var context = new Entities())
{
var n = context.Notes.Where(w => w.Id == note.Id).FirstOrDefault();
context.Entry(note).State = EntityState.Detached;
//context.Notes.Attach(note);
context.Entry(n).State = EntityState.Modified;
//context.Set<Notes>().Add(note);
context.SaveChanges();
}
none of this worked...
What i did before was i got the entity from db
attached it the savechanges and it worked... Now i cant make it work seems impossible.
Sometimes i also get this error:
Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since enti ...
Go to the complete details ...