title: NHibernate Linq Group By fails to group properly in SQL Server
body: <p>I have the following LINQ query which uses NHibernate against a SQL Server backed repository...</p>
  
  <pre><code>var casesByCaseOwner = this.preGrantDetailRepository.All
     .Where(x =&gt; x.CaseFileLocation.Id == cflId)
     .GroupBy(x =&gt; x.CaseOwner)
     .Select(x =&gt; new StagSummaryForCfItem
     {
        Id = x.Key.Id,
        Description = x.Key.Name,
        NumberOfCases = x.Count(),
        UninvoicedNetFee = x.Sum(y =&gt; y.UninvoicedNetFee),
        UninvoicedDisbursement = x.Sum(y =&gt; y.UninvoicedDisbursement)
     }).AsEnumerable();
  </code></pre>
  
  <p>However, it complains that SQL Server is unable to group by the <code>CaseOwner.Name</code> column because it is not contained in the select list or group clause. Coming from a database world I understand that error, however, I'm not sure how to force NHibernate to group by both <code>Id</code> and <code>Name</code> but still have the <code>CaseOwner</code> entity available to me in my Select.</p>