public virtual ITisDataLayerTreeNode Clone(EntityCloneSpec enEntityCloneSpec, Func <IEntityBase, string> nameingFun) { bool bCloneData = (enEntityCloneSpec & EntityCloneSpec.Data) > 0; bool bCloneOwnedChildren = (enEntityCloneSpec & EntityCloneSpec.OwnedChildren) > 0; bool bCloneLinkedChildren = (enEntityCloneSpec & EntityCloneSpec.LinkedChildren) > 0; // Performs clone, returns empty object ITisDataLayerTreeNode oCloned = this.CloneObject(nameingFun); // Clone parameters if requested if (bCloneData) { CloneDataTo(oCloned); } // Clone owned children if requested if (bCloneOwnedChildren) { CloneOwnedChildrenTo(oCloned, enEntityCloneSpec); } // Clone linked children if requested if (bCloneLinkedChildren) { CloneLinkedChildrenTo(oCloned, enEntityCloneSpec); } return(oCloned); }
private void CloneLinkedChildrenTo( ITisDataLayerTreeNode oTargetObj, EntityCloneSpec enEntityCloneSpec) { CloneChildrenTo( oTargetObj, this.TypeInfo.LinkedChildren, enEntityCloneSpec); }
private void CloneChildrenTo( ITisDataLayerTreeNode oTargetObj, ICollection <ITisEntityChildInfo> ChildrenInfoCollection, EntityCloneSpec enEntityCloneSpec) { foreach (ITisEntityChildInfo oChildInfo in ChildrenInfoCollection) { // Get source list INamedObjectList oSrcList = oChildInfo.GetChildList(this); // Get destination list INamedObjectList oDstList = oChildInfo.GetChildList(oTargetObj); // Add cloned objects to destination list TisDataLayerTreeNode oChildNode; for (int i = 0; i < oSrcList.Count; i++) { if (oSrcList is INamedObjectOrder) { oChildNode = ((oSrcList as INamedObjectOrder).GetByOrder(i)) as TisDataLayerTreeNode; } else { oChildNode = (oSrcList[oSrcList.NameByIndex(i)]) as TisDataLayerTreeNode; } // Clone ITisDataLayerTreeNode oClonedChildNode = oChildNode.Clone(enEntityCloneSpec); // Add to list oDstList.Add(oClonedChildNode); } } }
public ITisDataLayerTreeNode Clone(EntityCloneSpec enEntityCloneSpec) { return(Clone(enEntityCloneSpec, null)); }