I have a table Parent and a table Child. Child contains a foreign-key to the Parent table, creating a one-to-many relationship. Here is a part of my mapping that I define wi
It'll depend on your version of Fluent NHibernate. Up until a certain point it was the default that all entities would not be lazy loaded. This is the equivalent of explicitly setting lazy="false"
in your entity. This is no longer the case, but if you are running on anything prior to that point then you'll see this behaviour.
The many-to-one/references lazy load setting gets overridden by the entity level lazy load from the target, so if you are running on this older version of FNH then the entity setting will be rendering your References(...).LazyLoad()
call moot.
You need to verify you're on the latest version of FNH, that should fix things; however, if it doesn't then you need to explicitly set lazy loading on in your Parent
entity. You can do that with the LazyLoad
method on the ClassMap<T>
.