I'm trying to join a table to retreive and set a property on a POCO. Here's the scenario...
*NOTE - An application can belong to many user sessions.
UserSession (Table)
UserSessionId PK
ApplicationId FK
UserName
Application (Table)
ApplicationId PK
Name
UserSession (Poco)
string UserName get;
string ApplicationName get;
I've tried a join like this:
Join("Application", j => j.Inverse().KeyColumn("ApplicationId").Map(x => x.ApplicationName));
However, this uses the primary column of the UserSessionTable for the join column. The part of the query looks like this:
/**SNIP**/
inner join
Auditing.UserSession US
on this_.UserSessionId=US.UserSessionId
left outer join
Auditing.Application A
on US.UserSessionId=A.ApplicationId
/**SNIP**/
How can i configure nhibernate fluently to use the correct join column from the left table(UserSession)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…