mapped classes should have all virtual for all methods/properties if
using dynamic proxy generation
public virtual void AddChild(Child c)
On Wed, Sep 10, 2008 at 1:00 AM, Johan Kirsten <[EMAIL PROTECTED]> wrote:
>
> My problem is that when I am using bidirectional relationships, I want
> to set the child's parent reference from within the parent like so:
>
> public void AddChild(Child c)
> {
> c.Parent = this;
> children.Add(c);
> }
>
> I can then add the child to the parent like so:
>
> Parent p = (Parent) session.Load(typeof(Parent), id);
> Child c = new Child();
> p.AddChild(c);
>
> But then c.Parent != p
>
> I understand that this is because of the dynamic proxy / real object
> duality as explained by
> http://broloco.blogspot.com/2008/01/nhibernate-identity-map-and-proxies.html
>
> Does anybody have a solution to this?
>
> >
>
--
lachlan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---