title: Linq Group By Into with additional parameters
body: <p>I have following sql result:
  Table Result</p>
  
  <p><a href="https://i.stack.imgur.com/2DR5X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2DR5X.png" alt="enter image description here"></a></p>
  
  <p>Goal is to group this result by ProjectId and SequenceId. The later JSON Result should look like this:</p>
  
  <pre><code>[
    {
      "ProjectId": 1,
      "ProjectName": "Testprojekt 1",
      "Sequences": [
        { 
          "SequenceId": 2,
          "SequenceName": "ESN_Tauschen" 
        },
        {
          "SequenceId": 3,
          "SequenceName": "Demontage"
        }
      ]
    },
    {
      "ProjectId": 2,
      "ProjectName": "Testprojekt 2",
      "Sequences": [
        {
          "SequenceId": 3,
          "SequenceName": "Demontage"
        }
      ]
    }
  ]
  </code></pre>
  
  <p>My current linq expression gives me following result:</p>
  
  <pre><code>[
    {
      "ProjectId": 1,
      "Sequences": [
        2,
        3
      ]
    },
    {
      "ProjectId": 2,
      "Sequences": [
        3
      ]
    }
  ]
  
   var context = new ReworkPlace();
  
          var result = from p in context.Projects
                       join rs in context.ReworkStations on p.ProjectId equals rs.ProjectId
                       join l in context.ReworkStationReworkConfigurationLinkSets on rs.ReworkStationId equals
                           l.ReworkStationId
                       join rc in context.ReworkConfigurations on l.ReworkConfigurationId equals rc.ReworkConfigurationId
                       join s in context.Sequences on rc.SequenceId equals s.SequenceId
                       group s.SequenceId by p.ProjectId into g
                       select new
                       {
                           ProjectId = g.Key,
                           Sequences = g.ToList()
                       };
  
  
          return Json(result, JsonRequestBehavior.AllowGet);
  </code></pre>
  
  <p>I dont know how I have to adapt my linq expression to inlcude the <strong>not grouped properties</strong> like ProjectName, SequenceId and SequenceName into my json result.</p>
  
  <p>Would be nice if somebody could help me.</p>