Esempio n. 1
0
 private void RemoveObjects(
     INamedObjectList oList,
     ICollection oObjects)
 {
     foreach (INamedObject oObj in oObjects)
     {
         oList.Remove(oObj.Name);
     }
 }
Esempio n. 2
0
        public void RemoveObjectsFromSource()
        {
            ArrayList oAllRoots = new ArrayList();

            oAllRoots.AddRange(m_oCopyRoots.Keys);
            oAllRoots.AddRange(m_oForeignRoots);

            foreach (EntityBase oEntity in oAllRoots)
            {
                INamedObjectList oOwnerContainer = oEntity.OwnerContainter as INamedObjectList;
                //  GetOwnerContainer(oEntity);

                if (oOwnerContainer == null)
                {
                    continue;
                }

                oOwnerContainer.Remove(oEntity.Name);
            }
        }
Esempio n. 3
0
        private IEntityBase CopyObject(
            INamedObjectList oDstList,
            IEntityBase oEntity,
            bool bWithOwnedChildren)
        {
            IEntityBase oClonedEntity =
                PerformClone(oEntity);

            IEntityBase oDstListEntity = oClonedEntity;

            try
            {
                oDstList.Add(oClonedEntity);
            }
            catch
            {
                // Collision

                string sObjName = oEntity.Name;

                // Determine what to do
                CollisionAction enCollisionAction = GetCollisionAction(
                    ref sObjName,
                    oEntity.TypeInfo.TheType.Name,
                    oDstList);

                bool bRetryAdd = true;

                switch (enCollisionAction)
                {
                case CollisionAction.Rename:
                    oClonedEntity.Rename(sObjName);
                    break;

                case CollisionAction.Overwrite:
                    oDstList.Remove(oEntity.Name);
                    break;

                case CollisionAction.KeepOriginal:
                    oDstListEntity = (EntityBase)oDstList[oEntity.Name];
                    bRetryAdd      = false;
                    break;
                }

                if (bRetryAdd)
                {
                    oDstList.Add(oClonedEntity);
                }
            }

            m_oGraph[oEntity] = oDstListEntity;

            if (bWithOwnedChildren)
            {
                CopyOwnedChildren(
                    oEntity,
                    oDstListEntity,
                    true  // Recursive
                    );
            }

            return(oDstListEntity);
        }