The object cannot be deleted because it was not found in the ObjectStateManager in entity framework 5
I'm trying to delete an object using EntityFramework 5 but i get this error. The object cannot be deleted because it was not found in the ObjectStateManager I am using the Remove() method as DeleteObject() is not present in EF5. Can anyone help what am I missing? This does not work for Remove localDb.Customers.Remove(new Customer() { CustomerId = id }); localDb.SaveChanges(); Another thing I tried from msdn to change the state to Deleted. But here it gives an error saying all the fields should be present. Is it necessary to get the complete record then delete? var customer = new Customer(){