/// ------------------------------------------------------------------------------------ /// <summary> /// Do a deep copy of a single FDO object and all owned objects. /// 'Outside' references are duplicated. 'Inside' ones are set to the new copies. /// Basic/value properties are copied unchanged. /// </summary> /// <param name="source">FDO object</param> /// <param name="ownerFunct">The delegate used for adding the created object to an owner. /// </param> /// <returns>The copy</returns> /// ------------------------------------------------------------------------------------ internal static TTopLevel CloneFdoObject(TTopLevel source, CopiedOwner <TTopLevel> ownerFunct) { CopyObject <TTopLevel> copyObject = new CopyObject <TTopLevel>(source.Cache, ownerFunct); TTopLevel newObj = copyObject.CloneObjectInternal(source); return(newObj); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="CopyObject<TTopLevel>"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="topLevelOwnerFunct">The delegate used for adding the created object to /// an owner.</param> /// ------------------------------------------------------------------------------------ private CopyObject(FdoCache cache, CopiedOwner <TTopLevel> topLevelOwnerFunct) { m_cache = cache; m_servLoc = m_cache.ServiceLocator; m_sda = m_cache.DomainDataByFlid; m_mdc = m_cache.ServiceLocator.GetInstance <IFwMetaDataCacheManaged>(); m_topLevelOwnerFunct = topLevelOwnerFunct; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Do a deep copy of a collection of FDO objects and all owned objects. /// 'Outside' references are duplicated. 'Inside' ones are set to the new copies. /// Basic/value properties are copied unchanged. /// </summary> /// <param name="source">Collection or Sequence of FDO objects to copy</param> /// <param name="ownerFunct">The delegate used for adding the created object to an owner. /// </param> /// <returns>Returned object is a List of ICmObjects, internally.</returns> /// ------------------------------------------------------------------------------------ internal static IEnumerable <TTopLevel> CloneFdoObjects(IEnumerable <TTopLevel> source, CopiedOwner <TTopLevel> ownerFunct) { if (source.Count() == 0) { return(null); } CopyObject <TTopLevel> copyObject = new CopyObject <TTopLevel>(source.First().Cache, ownerFunct); return(copyObject.CloneObjectsInternal(source)); }