views:

46

answers:

0

I have several entities configured via FNH to eager load child entities using the FetchMode.Eager syntax when I request instances (from the database). Now I was under the impression this would ignore any lazy loading in the mapping and populate the child entities with the 'real' data.

The reason why I want to do this is because I want to use a Parallel.ForEach to iterate over a collection of entities and generate a set of results, but I get the following error:

[18000] System.InvalidOperationException:
There is already an open DataReader associated with this Command 
which must be closed first. 

If I use ' NHibernateUtil.Initialize' to initialise all child entities then it works as expected.

Am I wrong in my understanding in the use of FetchMode.Eager?