When I update Employee, I get an exception
"A violation of the referential integrity constraint has occurred. The property values ββthat define the referential constraints are incompatible between the main and dependent objects in the relation."
My code receives Employee, attaches to the context and saves the changes.
public void UpdateRAD_Tbl_OrderPatient(Employee emp)
{
try
{
this.ObjectContext.RAD_Tbl_OrderPatient.AttachAsModified(emp);
this.ObjectContext.SaveChanges();
this.ObjectContext.AcceptAllChanges();
}
catch(Exception ex)
{
}
}

An exception occurs if a foreign key is changed on this object.
How can I bind an object modifying this foreign key?
source
share