Pages

Tuesday 4 February 2014

An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key

Dim employeehierarchy = db.EmployeeHierarchies.Where(Function(m) m.EmployeeHierarchyId = employeehierarchydb.EmployeeHierarchyId).FirstOrDefault()
            Dim updateemployeehierarchy = db.Entry(employeehierarchy)
            updateemployeehierarchy.CurrentValues.SetValues(employeehierarchydb)
            db.SaveChanges()