NHibernate Linq提供程序中的Fetch vs FetchMany [英] Fetch vs FetchMany in NHibernate Linq provider
本文介绍了NHibernate Linq提供程序中的Fetch vs FetchMany的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如Fetch和FetchMany
完成NHibernate紧急加载. rel ="noreferrer"> NH Hablow Linq渴望获取,在Mike Hadlow的博客上.
NHibernate eager loading can be done using Fetch
and FetchMany
, as described in NHibernate Linq Eager Fetching on Mike Hadlow's blog.
这两种方法有什么区别?在什么情况下将分别使用?
What is the difference between these two methods and under what circumstance would each be used?
推荐答案
Fetch
用于引用,FetchMany
用于集合.
Fetch
should be used for references and FetchMany
for collections.
这尤其重要,因为只有FetchMany
可以与ThenFetchMany
组合以获取孙子"集合.
This is particularly important because only FetchMany
can be combined with ThenFetchMany
to fetch "grandchildren" collections.
示例:
session.Query<User>()
.FetchMany(u => u.Orders)
.ThenFetchMany(o => o.OrderItems)
这篇关于NHibernate Linq提供程序中的Fetch vs FetchMany的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文