title: How to remove rows for deleted fields from relationship table in entity framework
body: <p>I have the <code>Student</code>, <code>Course</code> and a relationship between them as <code>StudentCourse</code>. The fields in these classes are as follows:</p>
  
  <pre><code>public class Student
      {
          public int StudentId { get; set; }
          public string FirstName { get; set; }
          public string LastName { get; set; }
          public int CourseId { get; set; }
          [ForeignKey("CourseId")]
          public Course Course { get; set; }
      }
  
  
  public class Course
      {
          public int CourseId { get; set; }
          public string CourseName { get; set; }
      }
  
  
  
  public class StudentCourse
      {   
          public int ID { get; set; }
          public virtual Student Student { get; set; }
          public virtual Course Course {get;set;}
      }
  </code></pre>
  
  <p>When I delete the students in <code>student</code> table , then I want to remove the corresponding rows from the relationship <code>StudentClass</code>. How can I do  it?</p>