title: NHibernate Linq GroupBy multiple properties not working
body: <p>I am using NHibernate 3 Alpha 2, and I am trying to do the number of posts per month</p>
  
  <p>This is the code I came up with</p>
  
  <pre><code>List&lt;PostMonthFrequency&gt; monthFrequencies = _postRepository
      .FindAll()
      //.ToList() //&lt;- if included works. however not desired
      .OrderByDescending(x =&gt; x.PublishedOn)
      .GroupBy(x =&gt; new {x.PublishedOn.Year, x.PublishedOn.Month})
      .Select(post =&gt; new PostMonthFrequency { Month = new DateTime(post.Key.Year, post.Key.Month, 01), Freqency = post.Count() }).ToList();
  </code></pre>
  
  <p>please not the FindAll will return the Session.Query()</p>
  
  <p>I have also tried to remove the select</p>
  
  <p>the error I get is:</p>
  
  <blockquote>
    <p>NewExpression</p>
  </blockquote>
  
  <p>Thats it.. I have got other expression to work well with the select, so i do not think it is that, more to do with the Groupby</p>
  
  <p>Thanks in advance</p>
  
  <p>PS my temp fix</p>
  
  <pre><code>List&lt;PostMonthFrequency&gt; monthFrequencies = _postRepository
          .FindAll()
          .Select(x =&gt; x.PublishedOn)
          .ToList()
          .GroupBy(x =&gt; new { x.Year, x.Month })
          .Select(post =&gt; new PostMonthFrequency { Month = new DateTime(post.Key.Year, post.Key.Month, 01), Frequency = post.Count() })
          .ToList();
  </code></pre>