0
votes

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.

1

1 Answers

1
votes

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.