简体   繁体   中英

Using NHibernate LINQ, Is it possible to put a .Where() clause after a .ThenFetch()

I understand that in NHibernate LINQ, you need to have the fetches at the end of your code but how would you filter on something that is loaded via a ThenFetch ?

Here is an example

   IEnumerable<Project> list = Session.Query<Project>()
                                      .FetchMany(r => r.ProjectSponsors)
                                      .ThenFetch(r => r.Sponsor)
                                      .Where(r => !r.Name == "Joe");

this above doens't work as it throws a NotSupportedException .

Any ideas on the right way to implement the above query?

No currently it isn't. Fetch can only be used as last statement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM