title: Fluent NHibernate does not create IN part of WHERE clause
body: <p>I have Fluent NHibernate Linq queries where I check values based on run time arrays. A basic example would be something like:</p>
  
  <pre><code>var array = [1,2,3,4,5,6];
  using (var session = SessionProvider.SessionFactory.OpenSession())
  {
    return session.Query&lt;MyObject&gt;().Where(x =&gt; array.Contains(x.CompareVal)).ToList();
  }
  </code></pre>
  
  <p>I would expect the generated SQL statement to look something like this:</p>
  
  <pre><code>SELECT CompareVal, Column1, Column2
  FROM MyObject
  WHERE CompareVal IN (1,2,3,4,5,6)
  </code></pre>
  
  <p>However, what I'm finding instead is that the generated SQL statement simply emits the WHERE clause (proven by watching in Profiler) and selects the entire table, and then seems to run the filter in memory once it gets all the data back.</p>
  
  <p>Something to note - I have a Generic Repository class that all of these calls are funneled through. The Query method is as follows:</p>
  
  <pre><code>public IList&lt;T&gt; Query(Func&lt;T, bool&gt; criteria)
  {
    using (var session = SessionProvider.SessionFactory.OpenSession())
    {
      return session.Query&lt;T&gt;().Where(criteria).ToList();
    }
  }
  </code></pre>
  
  <p>Obviously this (lack of a where clause) is not acceptable in a table with a large amount of data. What can I do to force NHibernate to generate the query correctly with the WHERE clause and still keep a generic pattern for repositories?</p>