2013-01-15 16 views
3

我正在使用QueryOverApi,試圖在where子句中使用SQL表達式。我基本上有:SQL在QueryOver中的表達式API

 var query = CurrentSession.QueryOver<Appointment>(() => appt) 
      .JoinAlias(() => appt.Work,() => work) 
      .JoinAlias(()=>appt.Contact,()=>ct) 
      .JoinAlias (()=>ct.Tags,()=>tag) 
      .Where(Expression.Sql("(ct2_.OrganizationId in (SELECT....")) 

這個工程,但我不得不硬編碼我的別名ct2_。我怎麼知道nHibernate會將我的聯繫表別名爲ct2。

回答