There's a Not property that's used to invert a call. So you can do
LazyLoad() or Not.LazyLoad(), same with any other bool settings too.

I'll look at sorting this as soon as I can.

On 3/5/09, Kevin Miller <scound...@gmail.com> wrote:
> Ah ok. I was making my assumption that lazy loading was by default false
> based on seeing only a LazyLoad() method that did not seem to take a boolean
> parameter. This made me think that tacking LazyLoad() onto the end of the
> method chain would enable lazy loading. Bad assumption I guess and I should
> have dove more into the docs or code.
> Kevin Miller
>
>
> On Thu, Mar 5, 2009 at 3:20 AM, James Gregory
> <jagregory....@gmail.com>wrote:
>
>> I believe lazy is actually true by default. Either way, they Lazy methods
>> are required because you can override the default in conventions, so
>> someone
>> could set it to true (or false) and need the inverse method to their
>> setting.
>>
>>
>> On Thu, Mar 5, 2009 at 4:02 AM, KevM <scound...@gmail.com> wrote:
>>
>>>
>>> James,
>>>
>>> Yes the key-many-to-one element needs the lazy attribute.
>>>
>>> The SetAttribute method on the composite-id element actually throws a
>>> not implemented exception.
>>>
>>> I noticed today that the HasMany mapping was also not emitting a lazy
>>> attribute. Calling SetAttribute("lazy", "false") on that element works
>>> fine as a workaround but I think should not be necessary if FNH
>>> intends to default lazy to false.
>>>
>>> Thank you,
>>>
>>> Kevin
>>>
>>> On Mar 4, 6:16 pm, James Gregory <jagregory....@gmail.com> wrote:
>>> > Hey Kevin,
>>> > Just so I understand correctly, it's the key-many-to-one element that
>>> should
>>> > have a lazy attribute on, but when you use SetAttribute it's being put
>>> on
>>> > the composite-id element?
>>> >
>>> > If that's the case, then it shouldn't be a big change to get a Lazy
>>> property
>>> > that works that way. I'll create an issue if you confirm what I'm
>>> thinking.
>>> >
>>> >
>>> >
>>> > On Wed, Mar 4, 2009 at 9:58 PM, KevM <scound...@gmail.com> wrote:
>>> >
>>> > > I am very new to Fluent NH, and NHibernate in general so be gentle.
>>> >
>>> > > I ran into an issue today mapping a composite key with a reference.
>>> > > Here is the mapping:
>>> >
>>> > > WithTable("adp_sch_index");
>>> > > UseCompositeId()
>>> > >  .WithKeyProperty(x => x.IndexName, "index_name")
>>> > >  .WithKeyReference(x => x.TableDto, "type_id");
>>> >
>>> > > resulting in this hbm:
>>> > > ...
>>> > > <composite-id>
>>> > >  <key-many-to-one class="TableDto,..." name="TableDto"
>>> > > column="type_id" />
>>> > >  <key-property type="String" name="IndexName" column="index_name" />
>>> > > </composite-id>
>>> > > ...
>>> >
>>> > > The problem I am having is that I do not wish to be doing lazy
>>> > > loading
>>> > > but unfortunately the key-many-to-one element does not have a
>>> > > lazy="false" attribute.
>>> >
>>> > > Looking for an easy way to work around this Chad Myers pointed me at
>>> > > SetAttribute but unfortunately that only applies to the composite-id
>>> > > attribute (and is not implemented).
>>> >
>>> > > I ended up patching Fluent NH to do what I wanted to. It is my
>>> > > understanding that Fluent NH has lazy loading off by default. The
>>> > > assumption is based on the fact that I don't see a way to declare it
>>> > > off. I assumed that it would be OK to add a lazy=false attribute to
>>> > > the key-many-to-one element being emitted.
>>> >
>>> > > My patch is simple and has a test yet is not appropriate for
>>> > > submission because I couldn't figure out a good way to make the
>>> > > solution more general purpose for those wishing to have they
>>> > > composite
>>> > > key reference be lazy loaded.
>>> >
>>> > > Kevin Miller
>>>
>>>
>>
>> >
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to