I have two entities Student and course as below
public class Student
{
public int Id { get; set; }
public string Name { get; set; }
[System.Text.Json.Serialization.JsonIgnore]
public virtual IList<Course> Courses { get; set; }
}
public class Course
{
public int Id { get; set; }
public string Name { get; set; }
public virtual IList<Student> Students { get; set; }
[ForeignKey(nameof(TeacherId))]
public int TeacherId {get;set;}
public Teacher Teacher { get; set; }
}
Now I want to add list of grades to two entities containing grade and id of the course or Student depending on the situation. Do I have to define a entity grade with studentId and CourseId or is there any other way to do it without creating entity