NHibernate eager loading can be done using Fetch
and FetchMany
, as described in NHibernate Linq Eager Fetching on Mike Hadlow's blog.
NHibernate热切加载可以通过Fetch和FetchMany来完成,如NHibernate Linq在Mike Hadlow的博客中所描述的。
What is the difference between these two methods and under what circumstance would each be used?
这两种方法的区别是什么?在什么情况下会用到它们?
1 个解决方案
#1
95
Fetch
should be used for references and FetchMany
for collections.
Fetch应该被用于引用和收集。
This is particularly important because only FetchMany
can be combined with ThenFetchMany
to fetch "grandchildren" collections.
这一点特别重要,因为只有FetchMany可以与ThenFetchMany结合,以获取“孙子”集合。
Example:
例子:
session.Query<User>()
.FetchMany(u => u.Orders)
.ThenFetchMany(o => o.OrderItems)
#1
95
Fetch
should be used for references and FetchMany
for collections.
Fetch应该被用于引用和收集。
This is particularly important because only FetchMany
can be combined with ThenFetchMany
to fetch "grandchildren" collections.
这一点特别重要,因为只有FetchMany可以与ThenFetchMany结合,以获取“孙子”集合。
Example:
例子:
session.Query<User>()
.FetchMany(u => u.Orders)
.ThenFetchMany(o => o.OrderItems)