views:

16

answers:

1

Hi,

How do I Eager load a collection of objects in Fluent nHibernate? I going to loop through the collection and at the moment I'm getting an individual database call on each loop.

I'm using the auto mapper have this override

public void Override(AutoMapping<ParticipantCompany> mapping)
    {
        mapping.Not.LazyLoad();
    }

but it doesn't seem to work. Is there anything I should be putting in the AutoPersistanceModelGenerator.

I have seen plenty of examples of eager loading on child collections, but not on one single class.

Thanks, Tim

+1  A: 

Hi,

It turns out it was using IQueryable rather then IEnumerable for my collections.......

So all solved now. And I removed the mapping attempt above too.

Tim

BigTommy79