开发者

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

开发者 https://www.devze.com 2023-02-02 07:15 出处:网络
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?

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 开发者_JS百科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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号