示例#1
0
        private static void CopyInheritance(
            CommandProcessorContext cpc, KeyValuePair <EntityTypeClipboardFormat, EntityTypeClipboardFormat> inheritance,
            Dictionary <EntityTypeClipboardFormat, EntityType> entitiesMap)
        {
            var derivedEntity = entitiesMap[inheritance.Key] as ConceptualEntityType;
            var baseEntity    = entitiesMap[inheritance.Value] as ConceptualEntityType;

            Debug.Assert(derivedEntity != null, "EntityType derivedEntity is not a ConceptualEntityType");
            Debug.Assert(baseEntity != null, "EntityType baseEntity is not a ConceptualEntityType");

            var cmd = new CreateInheritanceCommand(derivedEntity, baseEntity);

            CommandProcessor.InvokeSingleCommand(cpc, cmd);
        }
        /// <summary>
        ///     This helper function creates a new entity in the conceptual model that is derived from the
        ///     passed in entity.
        ///     NOTE: If the cpc already has an active transaction, these changes will be in that transaction
        ///     and the caller of this helper method must commit it to see these changes commited.
        /// </summary>
        /// <param name="cpc"></param>
        /// <param name="name">The name of the new, derived entity</param>
        /// <param name="baseType">The entity that this new type should derive from</param>
        /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param>
        /// <returns>The new EntityType</returns>
        internal static ConceptualEntityType CreateDerivedEntityType(
            CommandProcessorContext cpc, string name, ConceptualEntityType baseType, bool uniquifyName)
        {
            var cet = new CreateEntityTypeCommand(name, uniquifyName);
            var inh = new CreateInheritanceCommand(cet, baseType);

            var cp = new CommandProcessor(cpc, cet, inh);

            cp.Invoke();

            var derivedType = cet.EntityType as ConceptualEntityType;

            Debug.Assert(derivedType != null, "EntityType is not ConceptualEntityType");
            return(derivedType);
        }
        private static void CopyInheritance(
            CommandProcessorContext cpc, KeyValuePair<EntityTypeClipboardFormat, EntityTypeClipboardFormat> inheritance,
            Dictionary<EntityTypeClipboardFormat, EntityType> entitiesMap)
        {
            var derivedEntity = entitiesMap[inheritance.Key] as ConceptualEntityType;
            var baseEntity = entitiesMap[inheritance.Value] as ConceptualEntityType;

            Debug.Assert(derivedEntity != null, "EntityType derivedEntity is not a ConceptualEntityType");
            Debug.Assert(baseEntity != null, "EntityType baseEntity is not a ConceptualEntityType");

            var cmd = new CreateInheritanceCommand(derivedEntity, baseEntity);
            CommandProcessor.InvokeSingleCommand(cpc, cmd);
        }
        /// <summary>
        ///     This helper function creates a new entity in the conceptual model that is derived from the
        ///     passed in entity.
        ///     NOTE: If the cpc already has an active transaction, these changes will be in that transaction
        ///     and the caller of this helper method must commit it to see these changes commited.
        /// </summary>
        /// <param name="cpc"></param>
        /// <param name="name">The name of the new, derived entity</param>
        /// <param name="baseType">The entity that this new type should derive from</param>
        /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param>
        /// <returns>The new EntityType</returns>
        internal static ConceptualEntityType CreateDerivedEntityType(
            CommandProcessorContext cpc, string name, ConceptualEntityType baseType, bool uniquifyName)
        {
            var cet = new CreateEntityTypeCommand(name, uniquifyName);
            var inh = new CreateInheritanceCommand(cet, baseType);

            var cp = new CommandProcessor(cpc, cet, inh);
            cp.Invoke();

            var derivedType = cet.EntityType as ConceptualEntityType;
            Debug.Assert(derivedType != null, "EntityType is not ConceptualEntityType");
            return derivedType;
        }