title: NHibernate Criteria Collection Contains
body: <p>I have a parent/child relationship mapped with a many-to-many set.</p>
  
  <pre><code>public class Parent
  {
      public ISet&lt;Child&gt; Children { get; set; }
  }
  
  public class Child {}
  
  public class ParentMap : ClassMap&lt;Parent&gt;
  {
      HasManyToMany(x =&gt; x.Children)
          .AsSet();
  }
  </code></pre>
  
  <p>How can I write a query to select all of the parents that contain a given child?  I would have guessed that it would be something like this, but this API does not exist:</p>
  
  <pre><code>Session.CreateCriteria&lt;Parent&gt;()
     .Add(Expression.Contains("Children", child)
     .List&lt;Parent&gt;();
  </code></pre>
  
  <p>I can't for the life of me find the answer anywhere.  My brain is not fully functioning today and Google has so far failed me.</p>