title: Using LINQ to delete multiple rows in table using matching key from related table
body: <p>Suppose I have models (and tables) that look like below:</p>
  
  <pre><code>Program: ProgramId (PKey)
  ProgramRegistration: ProgramRegistrationId (PKey), ProgramId (FKey)
  CourseEnrollments: CourseEnrollmentId (PKey), ProgramRegistrationId (FKey)
  </code></pre>
  
  <p>What I need to do is that in a controller I am passing an id that happens to be the ProgramId. I want to bulk delete all rows (or items) in CourseEnrollments that have a matching record in ProgramRegistration with the passed parameter id = ProgramId.</p>
  
  <p>So I figured I would do:</p>
  
  <pre><code>db.CourseEnrollments.Where(e =&gt; e.ProgramRegistration.ProgramId == id).ToList().Remove();
  </code></pre>
  
  <p>Question: Is the above approach of using navigation properties correct?</p>