mapped classes should have all virtual for all methods/properties if
using dynamic proxy generation

public virtual void AddChild(Child c)

On Sep 10, 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 
> byhttp://broloco.blogspot.com/2008/01/nhibernate-identity-map-and-proxi...
>
> Does anybody have a solution to this?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to