Reputation: 67068
I am using the QueryOverApi, trying to use a SQL Expression in the where clause. I have basically:
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...."))
This works but I have had to hardcode my alias ct2_. How can I figure out that nHibernate is going to alias my contact table as ct2.
Upvotes: 3
Views: 737
Reputation: 25628
You can't, at least in any official way. See the open issue here where someone has provided a patch: https://nhibernate.jira.com/browse/NH-1432
Upvotes: 2