/// <summary> /// Creates a new property in the passed in conceptual entity and optionally sets additional /// facets on the property. /// 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 property</param> /// <param name="entityType">Must be a conceptual entity</param> /// <param name="type">The type to use for this property (cannot be empty)</param> /// <param name="nullable">Flag whether the property is nullable or not</param> /// <param name="theDefault">Optional: the default value for this property</param> /// <param name="concurrencyMode">Optional: the concurrency mode for this property</param> /// <param name="getterAccessModifier">Optional: Get access modifier.</param> /// <param name="setterAccessModifier">Optional: Set access modifier.</param> /// <returns>The new Property</returns> internal static Property CreateConceptualProperty( CommandProcessorContext cpc, string name, ConceptualEntityType entityType, string type, bool?nullable, StringOrNone theDefault, string concurrencyMode, string getterAccessModifier, string setterAccessModifier, StringOrPrimitive <UInt32> maxLength, bool?fixedLength, StringOrPrimitive <UInt32> precision, StringOrPrimitive <UInt32> scale, bool?unicode, StringOrNone collation, string storeGeneratedPattern, InsertPropertyPosition insertPosition) { CommandValidation.ValidateConceptualEntityType(entityType); var cpcd = new CreatePropertyCommand(name, entityType, type, nullable, insertPosition); var scp = new SetConceptualPropertyFacetsCommand( cpcd, theDefault, concurrencyMode, getterAccessModifier, setterAccessModifier, maxLength, DefaultableValueBoolOrNone.GetFromNullableBool(fixedLength), precision, scale, DefaultableValueBoolOrNone.GetFromNullableBool(unicode), collation); var scpac = new SetConceptualPropertyAnnotationsCommand(cpcd, storeGeneratedPattern); var cp = new CommandProcessor(cpc, cpcd, scp, scpac); cp.Invoke(); return(cpcd.CreatedProperty); }
/// <summary> /// Creates a new property in the passed in conceptual entity and optionally sets additional /// facets on the property. /// 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 property</param> /// <param name="entityType">Must be a conceptual entity</param> /// <param name="type">The type to use for this property (cannot be empty)</param> /// <param name="nullable">Flag whether the property is nullable or not</param> /// <param name="theDefault">Optional: the default value for this property</param> /// <param name="concurrencyMode">Optional: the concurrency mode for this property</param> /// <param name="getterAccessModifier">Optional: Get access modifier.</param> /// <param name="setterAccessModifier">Optional: Set access modifier.</param> /// <returns>The new Property</returns> internal static Property CreateConceptualProperty( CommandProcessorContext cpc, string name, ConceptualEntityType entityType, string type, bool? nullable, StringOrNone theDefault, string concurrencyMode, string getterAccessModifier, string setterAccessModifier, StringOrPrimitive<UInt32> maxLength, bool? fixedLength, StringOrPrimitive<UInt32> precision, StringOrPrimitive<UInt32> scale, bool? unicode, StringOrNone collation, string storeGeneratedPattern, InsertPropertyPosition insertPosition) { CommandValidation.ValidateConceptualEntityType(entityType); var cpcd = new CreatePropertyCommand(name, entityType, type, nullable, insertPosition); var scp = new SetConceptualPropertyFacetsCommand( cpcd, theDefault, concurrencyMode, getterAccessModifier, setterAccessModifier, maxLength, DefaultableValueBoolOrNone.GetFromNullableBool(fixedLength), precision, scale, DefaultableValueBoolOrNone.GetFromNullableBool(unicode), collation); var scpac = new SetConceptualPropertyAnnotationsCommand(cpcd, storeGeneratedPattern); var cp = new CommandProcessor(cpc, cpcd, scp, scpac); cp.Invoke(); return cpcd.CreatedProperty; }