title: Delete object from an entity with many to many relationship
body: <p>I am new to Entity Framework so I need help with deleting an object from an entity. 
  I have 2 tables which are in many to many relationship and an association table connecting them in the database. In the model there are only two tables and the association one is presented by navigation properties as this is how the EF works. Now I need to delete an object from the first table by <code>context.EntityName.DeleteObject(object)</code> but when I try to do it the code fails with error "The DELETE statement conflicted with the REFERENCE constraint FK..", which is a foreign key from the association table to the entity, which object I try to delete. I wonder how to fix this. Could you please help me?</p>
  
  <p>Here is how the tables look like:</p>
  
  <h2>Teachers</h2>
  
  <ul>
  <li>Teacher_ID</li>
  <li>FirstName</li>
  <li>LastName</li>
  </ul>
  
  <h2>TimetableDetail</h2>
  
  <ul>
  <li>TimetableDetail_ID</li>
  <li>EducationalDiscipline_ID</li>
  <li>Weekday</li>
  <li>StartTime</li>
  <li>Duration</li>
  </ul>
  
  <p>and the associaion table:</p>
  
  <h2>TimetableDetailTeachers</h2>
  
  <ul>
  <li>Teacher_ID</li>
  <li>TimetableDetail_ID</li>
  </ul>
  
  <p>And here is how I try to delete it:</p>
  
  <pre><code>TimetablesEntities context = new TimetablesEntities();
  
  TimetableDetail detail = context.TimetableDetails.SingleOrDefault(td =&gt; td.TimetableDetail_ID == timetableDetailId);
  
  context.TimetableDetails.DeleteObject(detail);
  
  context.SaveChanges();
  </code></pre>
  
  <p>Thanks in advance!</p>