title: Linq to entities group join on multiple tables
body: <p>I'm trying to perform a group join on multiple tables with one to many relations, using <code>into</code> instead of <code>group by</code>. But something is not right. I get duplicate records for each Role a user has.</p>
  
  <pre><code>from compUsr in Repository.All&lt;CompanyUser&gt;()
  join usr in Repository.All&lt;User&gt;() on compUsr.UserId equals usr.Id
  join usrRole in Repository.All&lt;UserRole&gt;() on usr.Id equals usrRole.UserId
  join role in Repository.All&lt;Role&gt;() on usrRoles.RoleId equals role.Id into roles
      select new UserDTO()
      {
          Id = usr.Id,
          Email = usr.Email
          Roles = roles.Select(r =&gt; new RoleDTO()
          {
              Id = r.Id
          })
      }
  </code></pre>
  
  <p>If I remove the join on Role table, and place the <code>into</code> statement on UserRole, the grouping works like a charm, but UserRole is just a linking table, so the Role table is the one I'm interested in. Any ideas how to group this as simple as possible? Thanks!</p>