I've migrated my application from EF4 to EF5. I used the below code with the previous version to get related entity of a newly added item.
Student s = new Student();
s.Name = _name;
s.ClassID = _cID;
db.Students.Add(s);
db.SaveChanges();
ClassRoom c = s.ClassRoom;
so I used to get the specific class entity to c. But now s.ClassRoom returns null.
How do I get the ClassRoom entity for the student? Do I have to use db.ClassRooms.FirstOrDefault(....)?