How do I add multiple joins (Fetches) to a joined table using nhibernate and LINQ ?

Posted by ooo on Stack Overflow See other posts from Stack Overflow or by ooo
Published on 2011-01-02T13:24:42Z Indexed on 2011/01/02 13:53 UTC
Read the original article Hit count: 221

Filed under:
|
|
|

i have these tables /entities

VacationRequestDate table which has a VacationRequestId field that links with VacationRequest table
VacationRequest has PersonId and RequestStatusId fields that links with Person and RequestStatus respectively.

i have this query so far:

IEnumerable<VacationRequestDate> dates = Session.Query<VacationRequestDate>().Fetch(r => r.VacationRequest).ThenFetch(p=>p.RequestStatus).ToList();

this works fine and joins with VacationRequest and then VacationRequest joins with RequestStatus but i can't figure out how to add an additional EAGER join to the VacationRequest table.

If i add a Fetch at the end, it refers to the VacationRequestDate table
If i add a ThenFetch at the end, it refers to the RequestStatus table

I can't find any api that will refer to the VacationRequest table as the reference point.

how would you add multiple joins to a joined table using nhibernate LINQ ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ