title: Entity Framework - How to query object based on bridge table values?
body: <p>First, about my table setup:</p>
  
  <pre><code>Group:
      groupId - int
      groupName - varchar
  
  Schedule:
      scheduleId - int
      scheduleName - varchar
  
  Group_Schedules
      scheduleId - int/fk to Schedule
      groupId - int/fk to Group
  </code></pre>
  
  <p>I'm using the EF, in the above scenario, no EF entity is created to represent Group_Schedules, instead a collection is added to Group and Schedule tables representing the other end.</p>
  
  <p>I need to get all groups that belong to a schedule and have my return be an <code>IQueryable&lt;Group&gt;</code>. I.e (and no, this doesn't work because of the way EF generates the bridge table):</p>
  
  <pre><code>var g = from g in context.Groups
          where g.Group_Schedule.scheduleId = 1 // This doesn't work because Group_Schedule is a collection of Schedule
          select g;
  </code></pre>
  
  <p>Is there an elegant way to get the data I need?</p>