views:

1341

answers:

4

how to disable lazy loading in fn r1.0?

+7  A: 

You can try with:

Not.LazyLoad();

inside your mapping constructor.

Darin Dimitrov
did you try it because i did ... and it's not working
Chen Kinnrot
it worked for me. I wanted an object reference to be loaded with the object and this did it.
James Jones
It worked for us also. Our mapping has something like: HasMany(e => e.Children).KeyColumnNames.Add("ParentId").Cascade.AllDeleteOrphan().Not.LazyLoad();
Peter
A: 

Like this:

References(x => x.Something).Not.LazyLoad();
l3dx
+6  A: 
Fluently.Configure()
.Database(
       SQLiteConfiguration.Standard
       .InMemory)
       .Mappings( m => m.AutoMappings
           .Add( AutoMap.AssemblyOf<_Field>()  )
       .Conventions
           .Add( FluentNHibernate.Conventions.Helpers.DefaultLazy.Never() )
       .BuildSessionFactory();
Aaron Fischer
A: 

In my case NH loaded all children when parent was fetched. But each child was fetched by unique query.

maxlego
"Eager loading" != "no unique query". Eager loading often will use a seperate select statement. Use fetchmode to control this.
Jan Willem B