title: linq lambda multiple group joins
body: <p>I am trying to get a list of product along with its rating, comments and views. PID is product ID column without foreign key relationship.</p>
  
  <p>Product -</p>
  
  <pre><code>Id  Name
  1   P1
  2   P2
  </code></pre>
  
  <p>Rating -</p>
  
  <pre><code>Id  PID Rating
  1   1   5
  2   1   4
  3   2   3
  </code></pre>
  
  <p>Comments -</p>
  
  <pre><code>Id  PID Comment
  1   1   Good
  2   1   Average
  3   2   Bad
  </code></pre>
  
  <p>Views -</p>
  
  <pre><code>Id  PID View
  1   1   500
  2   1   200
  3   2   10
  </code></pre>
  
  <p>My class would look like this –</p>
  
  <pre><code>Public Class Product{
      public int Id { get; set; }
      public string Name { get; set; }
      public List&lt;Rating&gt; Ratings{ get; set; }
      public List&lt;Comments&gt; Comments{ get; set; }
      public List&lt;Views&gt; Views{ get; set; }
  }
  </code></pre>
  
  <p>I am trying to get this information using Linq group join, so that I get child collection.</p>
  
  <pre><code>IEnumerable&lt;Product&gt; _products = _context.Product.GroupJoin(_context.Rating, p=&gt;p.id, r=&gt;r.PID, (Product, Rating) =&gt; new Product(){
      //fill fields here
  });
  </code></pre>
  
  <p>But how to group other tables as well into single database query.</p>
  
  <p>Thanks</p>