Hello,

I've got a situation where I'd like to reference some children from
the parent, but the children can reference potentially multiple
parents. That's by design.

Allow me to explain:

class Parent
{
    public virtual IList<Child> Children { get; set; }
}

class Child
{
    public virtual Parent HusbandAndFather { get; set; }
    public virtual Parent WifeAndMother { get; set; }
}

In my Child mappings, references are allowed to get broken in the
Nullable, but not too broken, there should always be the zero, one, or
two references, all told, in the prescribed manner:

References(x => x.HusbandAndFather, @"HusbandAndFatherId")
    .LazyLoad()
    .Nullable();

References(x => x.WifeAndMother, @"WifeAndMotherId")
    .LazyLoad()
    .Nullable();

In my Parent mappings:

HasMany(x => x.Situations)
    .LazyLoad()
    .Inverse()
    .AsBag()
    .Cascade.AllDeleteOrphan();

I don't know if the Husband/Wife relationships are automatically
figured, or I need to further constraint in a .Where(), not even sure
how I would do that in Fluent-isms?

It's one thing there is a "simple" parent/child collection
relationship going on, but how is this handled?

Thank you...

Regards,

Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at https://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to