title: Does EF code-first require navigation properties for deleting many-to-many relationships?
body: <p>I have two POCOs participating in a many-to-many relationship.  "A" has a collection of "B" but there is no need for "B" to have a collection of "A".  When I delete "B" the records in the Join table are not removed.  It appears that Entity Framework code-first only deletes the Join records if there is a Navigation property.  Is this correct or is there another way?</p>
  
  <p>Example:</p>
  
  <pre><code>public class User() { 
     public int Id { get; set; }
     public string Name { get; set; }
     public List&lt;Role&gt; Roles { get; set; }
  }
  
  public class Role() { 
     public int Id { get; set; }
     public string Name { get; set; }
  }
  
  //... Mapping Config ...//
  this.HasMany(x =&gt; x.Roles)
     .WithMany(/*can't be expressed without navigation property*/)
     .Map(m =&gt; {
        m.MapLeftKey("Users_Id");
        m.MapRightKey("Roles_Id");
        m.ToTable("UserRoleLinks");
     });
  
  //... Deleting a Role that is in use ...//
  using(var ctx = new MyDbContext()) {
      var role = ctx.Roles.Find(1);
      ctx.Roles.Remove(role);
      ctx.SaveChanges();
  }
  </code></pre>
  
  <p>In this scenario, the UserRoleLinks records will be orphaned when the Role is deleted.  Mabye there is a different way to configure it?</p>