This question is locked. New answers and comments are not allowed.
In a simple class which has a reference to a single child, if that child is replaced, the original reference is orphaned.
Example:
Now, if in code I set this object, the original is orphaned because the reference is overwritten with the new object. Without specific management, how can this be solved similar to the delete-orphans setting if this would have have been a collection?
I would like to specify the delete-orphans on any child object that I want cleaned up when all references to it are removed.
Thanks,
David Hollins
Example:
class Parent
{
private Child _myChild;
public Child myChild
{
get { return _myChild; }
set { _myChild = value; } // original is orphaned when a new instance is set
}
}
Now, if in code I set this object, the original is orphaned because the reference is overwritten with the new object. Without specific management, how can this be solved similar to the delete-orphans setting if this would have have been a collection?
I would like to specify the delete-orphans on any child object that I want cleaned up when all references to it are removed.
Thanks,
David Hollins