Attach entity fron existing context to new context (Urgent)
Hi all,In my application, employee object called as follows,
personalModel.Domain.EmployeeDetail emp = new personalModel.Domain.EmployeeDetail();
theUc = new personalUC.PersonalDetailsUC();
emp = theUc.GetEmployeeDetails(employeeNo);
The above code works as required.
There is another object called objMemberhip holds the relationship with above emp object.
Before call membership save method emp object attach to the objMemberhip as follows,
objMemberhip.EmployeeDetail = emp;
theUc.SaveMembership(objMemberhip, Session["user"].ToString());
But above save method throws following error,
"An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported."
Any help