Turn of Lazy Load on Reference

400 views
Skip to first unread message

Jea

unread,
Apr 13, 2009, 9:06:51 AM4/13/09
to Fluent NHibernate
As I get it the default convention is like in Nhibernate, lazy load is
true by default. I want to turn of lazy load on a property, thought i
could do it like

References(x => x.Food).Cascade.None().Not.Nullable().Not.LazyLoad();
But it stills generates a Proxy. How do i turn it of?

Regards

Hudson Akridge

unread,
Apr 15, 2009, 1:13:05 AM4/15/09
to fluent-n...@googlegroups.com
You just found a bug :)

I'll fix it, but in the mean time, change the order of your lazy/nullable calls to be like so:

References(x => x.Food).Cascade.None().Not.LazyLoad().Not.Nullable();

That should work for you temporarily. The problem is the "Nullable" on a OneToMany isn't toggling the "Not" flag after it's called, thus, the second time you were calling Not, just before your lazy load, it was actually doing a "Not Not", or "True" ;)

Hudson Akridge

unread,
Apr 15, 2009, 1:38:20 AM4/15/09
to fluent-n...@googlegroups.com
Actually, the bug was on both the LazyLoad and Nullable settings for the Many-To-One.

Don't worry about my temporary workaround, I went ahead and checked in the fix. Grab the latest from the trunk and you should be good to go.
Reply all
Reply to author
Forward
0 new messages