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?
eager-loadingfetchlinqnhibernate
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?
Best Answer
Fetch
should be used for references andFetchMany
for collections.This is particularly important because only
FetchMany
can be combined withThenFetchMany
to fetch "grandchildren" collections.Example: