Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a new top-level owned object.
        /// </summary>
        /// <param name="srcFactory">The factory for creating the object.</param>
        /// <returns>The created object</returns>
        /// ------------------------------------------------------------------------------------
        private TTopLevel CreateTopLevelOwnedObj(IFdoFactoryInternal srcFactory)
        {
            // This is the top-level object we are copying so we need to add it to its
            // correct owner.
            TTopLevel newObj = (TTopLevel)srcFactory.CreateInternal();

            m_topLevelOwnerFunct(newObj);
            return(newObj);
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a new unowned object
        /// </summary>
        /// <typeparam name="TObj">The type of object</typeparam>
        /// <param name="srcFactory">The factory used to create the object</param>
        /// <param name="classId">The class id of the object</param>
        /// <returns>The created object</returns>
        /// ------------------------------------------------------------------------------------
        private TObj CreateUnownedObj <TObj>(IFdoFactoryInternal srcFactory, int classId)
            where TObj : ICmObject
        {
            TObj obj = (TObj)srcFactory.CreateInternal();

            if (!obj.IsValidObject)
            {
                throw new ArgumentException("Factory failed to create a valid object", "srcFactory");
            }

            return(obj);
        }