title: LINQ filter by field in joining table
body: <p>On all my tables I have an IsDeleted field so that I can toggle records on and off. I'm trying to figure out how to use LinqToSql to filter out deleted records in the join table but I don't know how to identify that table in the linq query. Here is my basic table definition:</p>
  
  <pre><code>    modelBuilder.Entity&lt;MenuItemsEntity&gt;().ToTable("MenuItems")
      .HasMany(m =&gt; m.UserGroups).WithMany(ur =&gt; ur.MenuItems)
      .Map(m =&gt;
      {
          m.ToTable("MenuItems_UserGroups")
              .MapLeftKey("MenuItemId")
              .MapRightKey("UserGroupId");
      });
  </code></pre>
  
  <p>and here is my linq statement so far:</p>
  
  <pre><code>var menuItems = _ctx.MenuItems.Where(x =&gt; !x.IsDeleted &amp;&amp; x.ParentId == parentId 
  &amp;&amp; x.UserGroups.Any(r =&gt; !r.IsDeleted &amp;&amp; r.Id == userGroupId));
  </code></pre>
  
  <p>This adds the IsDeleted check for tables MenuItems and UserGroups, but not for MenuItems_UserGroups. </p>
  
  <p>Any ideas?</p>