/// <summary> /// This helper function is an easy way to get a new entity type, entity set and key property in the /// new entity type created in the conceptual or storage model. /// 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 entity</param> /// <param name="setName">The name of the new set</param> /// <param name="createKeyProperty">A flag whether to create a new key property or not (sending false creates no new property)</param> /// <param name="propertyName">The name of the new property</param> /// <param name="propertyType">The type of the new property</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> /// <param name="isDefaultName">Flag whether the name is the default for new entity types/sets</param> /// <returns>The new EntityType</returns> internal static EntityType CreateEntityTypeAndEntitySetAndProperty( CommandProcessorContext cpc, string name, string setName, bool createKeyProperty, string propertyName, string propertyType, string propertyStoreGeneratedPattern, ModelSpace modelSpace, bool uniquifyNames, bool isDefaultName = false) { var cp = new CommandProcessor(cpc); var cet = new CreateEntityTypeCommand(name, modelSpace, uniquifyNames); cet.CreateWithDefaultName = isDefaultName; cp.EnqueueCommand(cet); var ces = new CreateEntitySetCommand(setName, cet, modelSpace, uniquifyNames); cp.EnqueueCommand(ces); if (createKeyProperty) { var cpcd = new CreatePropertyCommand(propertyName, cet, propertyType, false); cpcd.IsIdProperty = true; cp.EnqueueCommand(cpcd); var skpc = new SetKeyPropertyCommand(cpcd, true); cp.EnqueueCommand(skpc); var ssgpc = new SetStoreGeneratedPatternCommand(cpcd, propertyStoreGeneratedPattern); cp.EnqueueCommand(ssgpc); } cp.Invoke(); return(cet.EntityType); }
internal CreateAssociationSetCommand(string name, Association association, ModelSpace modelSpace) { ValidateString(name); CommandValidation.ValidateAssociation(association); Name = name; Association = association; CommandModelSpace = modelSpace; }
internal CreateAssociationSetCommand(string name, Association association, ModelSpace modelSpace) { ValidateString(name); CommandValidation.ValidateAssociation(association); Name = name; Association = association; CommandModelSpace = modelSpace; }
/// <summary> /// Creates an EntitySet of the passed in EntityType in either the conceptual or the storage model. /// </summary> /// <param name="name">The name to use for this set</param> /// <param name="entityType">The EntityType that this set will contain</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> internal CreateEntitySetCommand(string name, EntityType entityType, ModelSpace modelSpace, bool uniquifyName) { CommandValidation.ValidateEntityType(entityType); ValidateString(name); Name = name; EntityType = entityType; ModelSpaceValue = modelSpace; UniquifyName = uniquifyName; }
/// <summary> /// Creates an EntitySet of the passed in EntityType in either the conceptual or the storage model. /// </summary> /// <param name="name">The name to use for this set</param> /// <param name="entityType">The EntityType that this set will contain</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> internal CreateEntitySetCommand(string name, EntityType entityType, ModelSpace modelSpace, bool uniquifyName) { CommandValidation.ValidateEntityType(entityType); ValidateString(name); Name = name; EntityType = entityType; ModelSpaceValue = modelSpace; UniquifyName = uniquifyName; }
/// <summary> /// Creates a new entity type in either the conceptual model or the storage model. /// </summary> /// <param name="name">The name to use for this type</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> internal CreateEntityTypeCommand(string name, ModelSpace modelSpace, bool uniquifyName) : base(PrereqId) { ValidateString(name); Name = name; ModelSpaceValue = modelSpace; UniquifyName = uniquifyName; WriteProperty(ProposedNameProperty, name); }
/// <summary> /// Creates an EntitySet of a new type being created in either the conceptual or the storage model. /// </summary> /// <param name="name">The name to use for this set</param> /// <param name="prereq">The CreateEntityTypeCommand that is creating the new type</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> internal CreateEntitySetCommand(string name, CreateEntityTypeCommand prereq, ModelSpace modelSpace, bool uniquifyName) { ValidatePrereqCommand(prereq); ValidateString(name); Name = name; ModelSpaceValue = modelSpace; UniquifyName = uniquifyName; AddPreReqCommand(prereq); }
/// <summary> /// Creates an EntitySet of a new type being created in either the conceptual or the storage model. /// </summary> /// <param name="name">The name to use for this set</param> /// <param name="prereq">The CreateEntityTypeCommand that is creating the new type</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> internal CreateEntitySetCommand(string name, CreateEntityTypeCommand prereq, ModelSpace modelSpace, bool uniquifyName) { ValidatePrereqCommand(prereq); ValidateString(name); Name = name; ModelSpaceValue = modelSpace; UniquifyName = uniquifyName; AddPreReqCommand(prereq); }
/// <summary> /// Creates a new entity type in either the conceptual model or the storage model. /// </summary> /// <param name="name">The name to use for this type</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> internal CreateEntityTypeCommand(string name, ModelSpace modelSpace, bool uniquifyName) : base(PrereqId) { ValidateString(name); Name = name; ModelSpaceValue = modelSpace; UniquifyName = uniquifyName; WriteProperty(ProposedNameProperty, name); }
/// <summary> /// The behavior is as follow: /// Creates copy of EntityTypes and relationships between them from clipboard format in the Entity Model if: /// - The entity-types and/or relationships do not exist in the model. /// - The passed in diagram parameter is null. /// OR /// Create the associated diagram items in the Diagram Model if: /// - The diagram is not null AND entity-types and/or relationships exist in the model AND the corresponding diagram items do not exist in the diagram. /// </summary> /// <param name="diagram"></param> /// <param name="clipboardEntities"></param> /// <param name="modelSpace"></param> internal CopyEntitiesCommand(Diagram diagram, EntitiesClipboardFormat clipboardEntities, ModelSpace modelSpace) { _diagram = diagram; _clipboardEntities = clipboardEntities; _modelSpace = modelSpace; }
/// <summary> /// Creates a copy of EntityTypes and relationships between them from clipboard format /// </summary> /// <param name="property"></param> internal CopyEntitiesCommand(EntitiesClipboardFormat clipboardEntities, ModelSpace modelSpace) : this(null, clipboardEntities, modelSpace) { _clipboardEntities = clipboardEntities; _modelSpace = modelSpace; }
/// <summary> /// The behavior is as follow: /// Creates copy of EntityTypes and relationships between them from clipboard format in the Entity Model if: /// - The entity-types and/or relationships do not exist in the model. /// - The passed in diagram parameter is null. /// OR /// Create the associated diagram items in the Diagram Model if: /// - The diagram is not null AND entity-types and/or relationships exist in the model AND the corresponding diagram items do not exist in the diagram. /// </summary> /// <param name="diagram"></param> /// <param name="clipboardEntities"></param> /// <param name="modelSpace"></param> internal CopyEntitiesCommand(Diagram diagram, EntitiesClipboardFormat clipboardEntities, ModelSpace modelSpace) { _diagram = diagram; _clipboardEntities = clipboardEntities; _modelSpace = modelSpace; }
/// <summary> /// Creates a copy of EntityTypes and relationships between them from clipboard format /// </summary> /// <param name="property"></param> internal CopyEntitiesCommand(EntitiesClipboardFormat clipboardEntities, ModelSpace modelSpace) : this(null, clipboardEntities, modelSpace) { _clipboardEntities = clipboardEntities; _modelSpace = modelSpace; }
/// <summary> /// The behavior is as follow: /// Creates a copy of an EntityType from clipboard format in Entity Model if: /// - The entity-type does not exist in the model. /// - The passed in diagram parameter is null. /// OR /// Create the shape for the entity-type in the Diagram Model if: /// - The diagram is not null AND the entity-type exists in the model AND the corresponding entity-type-shape does not exist in the diagram. /// </summary> /// <param name="diagram"></param> /// <param name="clipboardEntity"></param> /// <param name="modelSpace"></param> internal CopyEntityCommand(Diagram diagram, EntityTypeClipboardFormat clipboardEntity, ModelSpace modelSpace) { _clipboardEntity = clipboardEntity; _modelSpace = modelSpace; _diagram = diagram; }
/// <summary> /// The behavior is as follow: /// Creates a copy of an EntityType from clipboard format in Entity Model if: /// - The entity-type does not exist in the model. /// - The passed in diagram parameter is null. /// OR /// Create the shape for the entity-type in the Diagram Model if: /// - The diagram is not null AND the entity-type exists in the model AND the corresponding entity-type-shape does not exist in the diagram. /// </summary> /// <param name="diagram"></param> /// <param name="clipboardEntity"></param> /// <param name="modelSpace"></param> internal CopyEntityCommand(Diagram diagram, EntityTypeClipboardFormat clipboardEntity, ModelSpace modelSpace) { _clipboardEntity = clipboardEntity; _modelSpace = modelSpace; _diagram = diagram; }
/// <summary> /// Creates a copy of EntityType from clipboard format /// </summary> /// <param name="clipboardEntity"></param> /// <param name="modelSpace"></param> /// <returns></returns> internal CopyEntityCommand(EntityTypeClipboardFormat clipboardEntity, ModelSpace modelSpace) : this(null, clipboardEntity, modelSpace) { }
/// <summary> /// This helper function is an easy way to get a new entity type, entity set and key property in the /// new entity type created in the conceptual or storage model. /// 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 entity</param> /// <param name="setName">The name of the new set</param> /// <param name="createKeyProperty">A flag whether to create a new key property or not (sending false creates no new property)</param> /// <param name="propertyName">The name of the new property</param> /// <param name="propertyType">The type of the new property</param> /// <param name="modelSpace">Either Conceptual or Storage</param> /// <param name="uniquifyName">Flag whether the name should be checked for uniqueness and then changed as required</param> /// <param name="isDefaultName">Flag whether the name is the default for new entity types/sets</param> /// <returns>The new EntityType</returns> internal static EntityType CreateEntityTypeAndEntitySetAndProperty( CommandProcessorContext cpc, string name, string setName, bool createKeyProperty, string propertyName, string propertyType, string propertyStoreGeneratedPattern, ModelSpace modelSpace, bool uniquifyNames, bool isDefaultName = false) { var cp = new CommandProcessor(cpc); var cet = new CreateEntityTypeCommand(name, modelSpace, uniquifyNames); cet.CreateWithDefaultName = isDefaultName; cp.EnqueueCommand(cet); var ces = new CreateEntitySetCommand(setName, cet, modelSpace, uniquifyNames); cp.EnqueueCommand(ces); if (createKeyProperty) { var cpcd = new CreatePropertyCommand(propertyName, cet, propertyType, false); cpcd.IsIdProperty = true; cp.EnqueueCommand(cpcd); var skpc = new SetKeyPropertyCommand(cpcd, true); cp.EnqueueCommand(skpc); var ssgpc = new SetStoreGeneratedPatternCommand(cpcd, propertyStoreGeneratedPattern); cp.EnqueueCommand(ssgpc); } cp.Invoke(); return cet.EntityType; }
/// <summary> /// Creates a copy of EntityType from clipboard format /// </summary> /// <param name="clipboardEntity"></param> /// <param name="modelSpace"></param> /// <returns></returns> internal CopyEntityCommand(EntityTypeClipboardFormat clipboardEntity, ModelSpace modelSpace) : this(null, clipboardEntity, modelSpace) { }