title: NHibernate: Is it possible to add restriction based on alias name
body: <p>Say I create a criteria query and transform it with the AliasToBean result transormer. </p>
  
  <pre><code>session.CreateCriteria&lt;Staff&gt;("s")
    .CreateAlias("supervisor", "super")
    .SetProjection(Projections.ProjectionList()
      .Add(Projections.Property("s.name"), "name")
      .Add(Projections.Property("super.name"), "supervisor_name"))
    .SetResultTransformer(Transformers.AliasToBean&lt;StaffView&gt;());
  </code></pre>
  
  <p>Is it possible to add a restriction when you only know the property name of the bean? You can AddOrder using the bean property names but the Restrictions only appear to work with the actual property name. I'm guessing this is because they are applied before the transformation, much like you don't use a column alias in a where clause but you can in the order by.</p>
  
  <pre><code>//throws exception like cannot find property supervisor_name in Staff class
  //only "super.name" works
  .Add(Restrictions.Like("supervisor_name", "blah"))
  
  //this works though
  .AddOrder(Order.Asc("supervisor_name")) 
  </code></pre>
  
  <p>So basically I need a way to get the aliased property name based on the alias. I can think of multiple ways to do this, but I was hoping NHibernate had some existing method? I could for example keep a separate map of the property to alias names or just map to a database view so there is no need to transform to bean.</p>