I have an object that has many assocations to other objects. All of these are fetched lazily by nHibernate, which is good in almost all cases.
In a particular scenario, in this case an export of a lot of records, I want to set the Fetchmode to eager on all associations. Is there a way to do this, without having to manually specify each one:
ICriteria crit = CreateCriteria().
.SetFetchMode("Address", FetchMode.Eager)
.SetFetchMode("ContactPerson", FetchMode.Eager);
The method I would like to find, but haven't been able to:
// This doesn't work.
ICriteria crit = CreateCriteria().SetFetchMode(FetchMode.Eager);