예제 #1
0
        internal void AddToChild(ParentOneChild_Child parentOneChild_Child)
        {
#if DEBUG
            if (parentOneChild_Child == ParentOneChild_Child.NoParentOneChild_Child)
            {
                throw new Exception();
            }
            if ((parentOneChild_Child.Key >= 0) && (Key < 0))
            {
                throw new Exception();
            }
            if (Child == parentOneChild_Child)
            {
                throw new Exception();
            }
#endif
            if (Child != null)
            {
                throw new Exception($"ParentOneChild_Parent.AddToChild(): '{Child}' is already assigned to Child, it is not possible to assign now '{parentOneChild_Child}'.");
            }
            Child = parentOneChild_Child;
            onAddedToChild(parentOneChild_Child);
#if DEBUG
            DC.Trace?.Invoke($"Add ParentOneChild_Child {parentOneChild_Child.GetKeyOrHash()} to " +
                             $"{this.GetKeyOrHash()} ParentOneChild_Parent.Child");
#endif
        }
예제 #2
0
        internal void RemoveFromChild(ParentOneChild_Child parentOneChild_Child)
        {
#if DEBUG
            if (Child != parentOneChild_Child)
            {
                throw new Exception($"ParentOneChild_Parent.RemoveFromChild(): Child does not link to parentOneChild_Child '{parentOneChild_Child}' but '{Child}'.");
            }
#endif
            Child = null;
            onRemovedFromChild(parentOneChild_Child);
#if DEBUG
            DC.Trace?.Invoke($"Remove ParentOneChild_Child {parentOneChild_Child.GetKeyOrHash()} from " +
                             $"{this.GetKeyOrHash()} ParentOneChild_Parent.Child");
#endif
        }
 /// <summary>
 /// Called after a parentOneChild_Child gets removed from Child.
 /// </summary>
 partial void onRemovedFromChild(ParentOneChild_Child parentOneChild_Child)
 {
 }
 /// <summary>
 /// Called after a parentOneChild_Child gets added to Child.
 /// </summary>
 partial void onAddedToChild(ParentOneChild_Child parentOneChild_Child)
 {
 }