fluent nhibernate r1.0 fluent mapping disable lazy

2019-03-13 15:59发布

问题:

how to disable lazy loading in fn r1.0?

回答1:

Fluently.Configure()
.Database(
       SQLiteConfiguration.Standard
       .InMemory)
       .Mappings( m => m.AutoMappings
           .Add( AutoMap.AssemblyOf<_Field>() ) )
       .Conventions
           .Add( FluentNHibernate.Conventions.Helpers.DefaultLazy.Never() )
       .BuildSessionFactory();


回答2:

You can try with:

Not.LazyLoad();

inside your mapping constructor.



回答3:

Like this:

References(x => x.Something).Not.LazyLoad();