title: Nhibernate 3 - LINQ Issues
body: <p>my application has the following code to add a ToSortedList extension method on any IEnumberable:</p>
  
  <pre><code>public class SortedList&lt;T, TResult&gt; : List&lt;T&gt; {
      public SortedList(IEnumerable&lt;T&gt; source, Expression&lt;Func&lt;T, TResult&gt;&gt; sortBy, SortDirection sortDirection) {
          Initialize(source is IQueryable&lt;T&gt; ? source as IQueryable&lt;T&gt; : source.AsQueryable(), sortBy, sortDirection);
      }
  
      protected void Initialize(IQueryable&lt;T&gt; source, Expression&lt;Func&lt;T, TResult&gt;&gt; sortBy, System.Web.UI.WebControls.SortDirection sortDirection) {
          AddRange(sortDirection == SortDirection.Ascending ? source.OrderBy(sortBy) : source.OrderByDescending(sortBy));
      }
  }
  
  public static class SortingExtensions {
      public static SortedList&lt;T, TResult&gt; ToSortedList&lt;T, TResult&gt;(this IEnumerable&lt;T&gt; source, Expression&lt;Func&lt;T, TResult&gt;&gt; sortBy, SortDirection sortDirection) {
          return new SortedList&lt;T, TResult&gt;(source, sortBy, sortDirection);
      }
  }
  </code></pre>
  
  <p>In the old LINQ provider (on top of NHibernate 2.1) i could then say:</p>
  
  <pre><code>session.Linq&lt;Article&gt;().ToSortedList(a =&gt; a.Date, SortDirection.Ascending);
  </code></pre>
  
  <p>However using the new in-built LINQ provider in NHibernate 3 (change Linq to Query above) this does not work and the following error is thrown:</p>
  
  <p>"Specified method is not supported." - within the Initialize method</p>
  
  <p>I'd really appreciate it if someone could show me how this could be done.</p>