Thanks James. As I'm a complete NH newbie I just have to figure out
how to apply Conventions... any hint?

This is how my sample map-classes looks like, is this correct if I
want to eager load any Messages that belong to a Person?

    public class PersonMap : ClassMap<Person>
    {
        public PersonMap()
        {
            Id(x => x.Id, "PersonId");
            Map(x => x.Name);

            HasMany<Message>(x => x.Messages)
                .AsList()
                .WithKeyColumn("PersonId");
        }
    }


    public class MessageMap : ClassMap<Message>
    {
        public MessageMap()
        {
            Id(x => x.Id, "MessageId");
            Map(x => x.Text);

            NotLazyLoaded();
        }
    }

Thanks for any help. Getting NHibernate to work in a safe way with WCF
was not as easy as I first thought it was going to be :)

/Johan

On Dec 22, 5:13 pm, "James Gregory" <jagregory....@gmail.com> wrote:
> I think you've encountered a flaw in one of my recent changes. I recently
> changed the default lazy-load to be true rather than false (as it used to
> be), but it's obvious now that we haven't fully exposed a way to override
> this in specific instances.
> Do you need it to only affect this one collection or is it a project wide
> setting? If it's project wide, you can (re-)override the default lazy-load
> convention to be false.
>
> Depending on how you're doing your mapping, you can either pass in a
> Conventions class to the MappingVisitor, or into the AutoMapper.
>
> var conventions = new Conventions();
> conventions.DefaultLazyLoad = false;
>
> I'll look at adding the ability to invert the lazy-load on specific cases
> when I next can.
>
> On Mon, Dec 22, 2008 at 4:01 PM, Johan Danforth 
> <johan.danfo...@gmail.com>wrote:
>
>
>
>
>
> > I want to use Fluent NHibernate from within a WCF service but I'm
> > still working on a good session lifetime management solution and the
> > session seems to close before the serialization of lazy loaded
> > collections. I'm trying to turn off lazy loading but I just cannot
> > get
> > it to work well. I've set NotLazyLoaded() on my map-class, but it's
> > still being lazily loaded.
>
> > Any suggestions on how to turn it off properly (in fluent)?
>
> > Many thanks and seasons greetings!
>
> > /Johan- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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