title: ICriteria subquery
body: <p>I have to simple entities</p>
  
  <pre><code>    public class EntityA
      {
           public virtual int ID { get;set;}
           public virtual string Name { get;set;}
           public virtual IList&lt;EntityB&gt; BList { get;set;}
  
           public EntityA()
           {
              BLIst = new List&lt;EntityB&gt;();
           }
      }
  
  
      public class EntityB
      {
           public virtual int ID { get;set;}
           public virtual string Name { get;set;}
           public virtual int Value { get;set;}
           public virtual EntityA EntityA { get;set;}
      }
  </code></pre>
  
  <p>How do i make a ICriteria Query where EntityA.Name = 'SearchString' and List should be queried (((EntityB.Name='Name1' And (EntityB.Value=1)) And ((EntityB.Name='Name2') And (EntityB.Value=1)))</p>
  
  <p>The search can contain a List and i tried the following query:</p>
  
  <pre><code>            if (SearchBLIst.Count &gt; 0)
              {
                  foreach (EntityB searchAttribute in SearchBLIst)
                  {
                      Junction disjunction1 = Restrictions.Disjunction();
                      disjunction1.Add(
                                  Expression.Eq("entityB.ID", searchAttribute.ID) &amp;&amp;
                                  Expression.Ge("attributeValues.Value",searchAttribute.value));
                      store.Add(disjunction1);
  
                  }
              }
  </code></pre>