Data Annotations - InverseProperty Attribute
public class Course
{
public int CourseId { get; set; }
public string CourseName { get; set; }
public string Description { get; set; }
public Teacher OnlineTeacher { get; set; }
public Teacher ClassRoomTeacher { get; set; }
}
public class Teacher
{
public int TeacherId { get; set; }
public string Name { get; set; }
[InverseProperty("OnlineTeacher")]
public ICollection<Course> OnlineCourses { get; set; }
[InverseProperty("ClassRoomTeacher")]
public ICollection<Course> ClassRoomCourses { get; set; }
}