title: NHibernate OrderBy Projection on Child Objects
body: <p>I have 2 entities <code>OrganisationMember</code> and <code>User</code></p>
  
  <p>An <code>OrganisationMember</code> has a object Property called <code>User</code> of type <code>User</code>.</p>
  
  <p>I'm trying to write an NHibernate Query which will do a case insensitive sory by the <code>User.Email</code> property... (users typing emails into the system in various cases).</p>
  
  <p>I've seen that you can use a SQLFunction Projection to basically upper case everything at the DB and order by that. but I'm having trouble applying this to the child object. Here's what I have so far.</p>
  
  <pre><code>var query = Session.QueryOver&lt;OrganisationMembership&gt;();
  
  query.RootCriteria.SetFetchMode("User", FetchMode.Eager);
  
  var projection = Projections.SqlFunction("UPPER", NHibernateUtil.String, Projections.Property("Email"));
  
  query.OrderBy(projection).Asc();
  </code></pre>
  
  <p>It keeps telling me that it doesn't know what "Email" is in the projection. I've also tried changing the projection to </p>
  
  <pre><code>var projection = Projections.SqlFunction("UPPER", NHibernateUtil.String,  Projections.Property("User.Email"));
  </code></pre>
  
  <p>Any ideas ?</p>