I am trying to update a record using Entity Framework 6, code-first, no fluent mapping or a tool like Automapper.
The entity(Employee) has other composi
Employee
This worked for myself
var aExists = _db.Model.Find(newOrOldOne.id); if(aExists==null) { _db.Model.Add(newOrOldOne); } else { _db.Entry(aExists).State = EntityState.Detached; _db.Entry(newOrOldOne).State = EntityState.Modified; }