title: Eager Load many to Many - EF Core
body: <p>Hello I have a many to many relationship set up like following.    </p>
  
  <pre><code>public class order
  {
      public int id { get; set; }    
      public virtual ICollection&lt;OrderProducts&gt; Products { get; set; }
  }
  
  public class product
  {
      public int id { get; set; }
      public virtual ICollection&lt;OrderProducts&gt; Orders { get; set; }
  }
  
  public class OrderProducts
  {
      public int OrderId { get; set; }
      public virtual Order Order{ get; set; }
  
      public int ProductIdId { get; set; }
      public virtual Product Product { get; set; }   
  }
  </code></pre>
  
  <p>I would like to Include (Eager load) all products into their orders, but when using same approach like shown with customer, my product list get populated with OrderProducts-objects and not Product-objects </p>
  
  <pre><code>public IEnumerable&lt;Order&gt; GetAll()
  {
      return dataContext.Orders
                        .Include(order =&gt; order.Customer)
                        // now include all products aswell..
  }
  </code></pre>
  
  <p>I have tried stuff like witout any luck</p>
  
  <pre><code>  .Include(order =&gt; order.Products.Where(op =&gt; op.OrderId == order.Id).Select(p =&gt; p.Product))
  </code></pre>
  
  <p>So would appreciate if someone could help me out here..
  You'r also most welcome to share any good resources on how to construct more advanced lambdas, since i'm not that familiar with this yet..</p>