title: nhibernate queryover join alias with a where-or clause
body: <p>I'll just post the code:</p>
  
  <pre><code>public IList&lt;Dish&gt; GetByNameDishTypes(IEnumerable&lt;string&gt; names,
      IEnumerable&lt;string&gt; dishTypes)
  {
      // return dishes (ie food) whose name is in the names enumerable,
      // or whose type is in the dish types enumerables
      // (this would be 'breakfast', 'dinner') ..
  
      var namesArr = names != null ? names.ToArray() : new string[0];
      var dishTypesArr = dishTypes != null ? dishTypes.ToArray() : new string[0];
  
      var criteria = this.Session.CreateCriteria&lt;Dish&gt;();
      criteria.CreateAlias("DishType", "dt");
      criteria.Add(
          Restrictions.Or
          (
              Restrictions.In("Name", namesArr),
              Restrictions.In("dt.Name", dishTypesArr)
          ));
  
      return criteria.List&lt;Dish&gt;();
  
      /* get this to work?
      Dish d = null;
      DishType dt = null;
      return this.Session.QueryOver&lt;Dish&gt;(() =&gt; d)
          .JoinAlias(() =&gt; d.DishType, () =&gt; dt)
          .Where(
              Restrictions.Or
              (
                  Restrictions.In(d.Name, namesArr),
                  Restrictions.In(dt.Name, dishTypesArr)
              ))
          .List&lt;Dish&gt;(); */
  }
  </code></pre>
  
  <p>So, I'd like to know how to do this with QueryOver. This QueryOver code I posted throws a null reference exception. The criteria code works.</p>
  
  <p>Thank you :)</p>