title: How to delete circular many to many in entity framework 4.0?
body: <p>I have 3 tables: </p>
  
  <blockquote>
    <p>Users (Id, ..) , Groups(Id,..) and Users_Groups(Id_User, Id_Group)</p>
  </blockquote>
  
  <p>with rows: </p>
  
  <blockquote>
    <p>Users(Id = 1, 3), Groups(Id = 1, 2) and Users_Groups((1,1), (3, 1),
    (3, 2), (1, 2))</p>
  </blockquote>
  
  <p>And I want to delete all the rows.</p>
  
  <p>I have no direct access to table <code>Users_Groups</code>, only: User u;u.Groups .. and Group g;g.Users...</p>
  
  <p>Rows have circular dependecy so I can't delete like this:</p>
  
  <pre><code>User user1 = context.Users.FirstOrDefault(x =&gt; x.Id == 1);
  user1.Groups.Remove(g1);//g1 is a row from table Groups with Id = 1
  </code></pre>
  
  <p>because g1 depends on u3, u3 depends on g2, and g2 depends on u1.</p>
  
  <p>If a had direct access to table<code>Users_Groups</code> i would first delete the relationship and then from Users and Groups.</p>
  
  <p>Please help me to delete all rows in entity framework 4.0.</p>