Hi Guys,
I am having a real issue with the EF v1. I have quite a big EDMX with maybe 50 entitys mapped, but this one entity is causing me grief. The entity has mappings to other entitys with in effect are reference tables, but for some reason it is trying to do an Insert and not just update its self. Here is a fragment of my code..
using (var context = new someEntities()) { var studentCourseJoin = context.StudentCourseJoinSet.Where(o => o.Code == scjCode).First();
studentCourseJoin.EntryStatus = new EntryStatus { Code = viewModel.StudentDetails.EntryStatusCode };
studentCourseJoin.ParentalInHigherEducation = new ParentalInHigherEducation { Code = viewModel.StudentDetails.ParentalInHigherEducationCode };
studentCourseJoin.School = new School { Code = viewModel.StudentDetails.SchoolCode };
studentCourseJoin.Institution = new Institution { Code = viewModel.StudentDetails.InstitutionCode };
studentCourseJoin.LastSchoolEndYear = viewModel.StudentDetails.LastSchoolEndYear;
studentCourseJoin.LastInstitutionEndYear = viewModel.StudentDetails.LastInstitutionEndYear;
// Bloes up here tryign to do an insert on the studentCourseJoin.Institution. But if I removed this one, then it will blow up on another one.
context.SaveChanges(true);
}
If anyone has ANY ideas please, they would help alot.