title: Get records via foreign key in another table in Entity Framework 6
body: <p>I need to get all seats attached to a specific reservation. </p>
  
  <p>I have these classes:</p>
  
  <pre><code>public class Seat
  {
      public Guid Id { get; set; }
      public string RowNumber { get; set; }
      public int SeatNumber { get; set; }
  }
  
  public class ReservationSeat
  {
      public Guid Id { get; set; }
      public Guid ReservationId { get; set; }
      public Guid SeatId { get; set; }
  
      public Reservation Reservation { get; set; }
      public Seat Seat { get; set; }
  }
  </code></pre>
  
  <p>I have tried with this linq to entities statement but with no luck. It seems to return all the seats from the seats table.</p>
  
  <pre><code>public static List&lt;Seat&gt; GetSeatsForReservation(Guid reservationId)
  {
      using (var db = new EntityContext())
      {
          return db.Seats.Where(s =&gt; db.ReservationSeat
                                       .Select(rs =&gt; rs.ReservationId)
                                       .Contains(reservationId)).ToList();
      }
  }
  </code></pre>