/// <summary> /// Sets facets on the property being created by the passed in command. /// </summary> /// <param name="prereq">Must be non-null command creating the conceptual property</param> /// <param name="theDefault">Optional facet</param> /// <param name="concurrencyMode">Optional facet</param> /// <param name="getterAccessModifier">Optional facet</param> /// <param name="setterAccessModifier">Optional facet</param> internal SetConceptualPropertyFacetsCommand( CreatePropertyCommand prereq, StringOrNone theDefault, string concurrencyMode, string getterAccessModifier, string setterAccessModifier, StringOrPrimitive<UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive<UInt32> precision, StringOrPrimitive<UInt32> scale, BoolOrNone unicode, StringOrNone collation) : base(prereq, theDefault, maxLength, fixedLength, precision, scale, unicode, collation, concurrencyMode) { _getterAccessModifier = getterAccessModifier; _setterAccessModifier = setterAccessModifier; }
/// <summary> /// Sets facets on the property being created by the passed in command. /// </summary> /// <param name="prereq">Must be non-null command creating the conceptual property</param> /// <param name="theDefault">Optional facet</param> /// <param name="concurrencyMode">Optional facet</param> /// <param name="getterAccessModifier">Optional facet</param> /// <param name="setterAccessModifier">Optional facet</param> internal SetConceptualPropertyFacetsCommand( CreatePropertyCommand prereq, StringOrNone theDefault, string concurrencyMode, string getterAccessModifier, string setterAccessModifier, StringOrPrimitive <UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive <UInt32> precision, StringOrPrimitive <UInt32> scale, BoolOrNone unicode, StringOrNone collation) : base(prereq, theDefault, maxLength, fixedLength, precision, scale, unicode, collation, concurrencyMode) { _getterAccessModifier = getterAccessModifier; _setterAccessModifier = setterAccessModifier; }
internal static string StringConverter(BoolOrNone val) { if (val.StringValue != null) { // returns None value return val.StringValue; } else { // returns true and false values as strings return "" + val.PrimitiveValue.ToString(); } }
/// <summary> /// Change various aspects of the passed in Function Import. The passed in function import will be modified based on the /// other passed-in parameters (null is not ignored). /// </summary> /// <param name="fi"></param> /// <param name="function"></param> /// <param name="functionImportName"></param> /// <param name="returnType">Object of type EntityType or string representing the primitive type/'None'</param> internal ChangeFunctionImportCommand( ConceptualEntityContainer ec, FunctionImport fi, Function function, string functionImportName, BoolOrNone functionImportIsComposable, bool changeReturnType, object returnType) { CommandValidation.ValidateFunctionImport(fi); ValidateString(functionImportName); FunctionImport = fi; Function = function; EntityContainer = ec; FunctionImportName = functionImportName; FunctionImportIsComposable = functionImportIsComposable; ChangeReturnType = changeReturnType; ReturnSingleType = returnType; _efContainerToBeNormalized = new List <EFContainer>(); }
/// <summary> /// Change various aspects of the passed in Function Import. The passed in function import will be modified based on the /// other passed-in parameters (null is not ignored). /// </summary> /// <param name="fi"></param> /// <param name="function"></param> /// <param name="functionImportName"></param> /// <param name="returnType">Object of type EntityType or string representing the primitive type/'None'</param> internal ChangeFunctionImportCommand( ConceptualEntityContainer ec, FunctionImport fi, Function function, string functionImportName, BoolOrNone functionImportIsComposable, bool changeReturnType, object returnType) { CommandValidation.ValidateFunctionImport(fi); ValidateString(functionImportName); FunctionImport = fi; Function = function; EntityContainer = ec; FunctionImportName = functionImportName; FunctionImportIsComposable = functionImportIsComposable; ChangeReturnType = changeReturnType; ReturnSingleType = returnType; _efContainerToBeNormalized = new List<EFContainer>(); }
/// <summary> /// Sets facets on the passed in property. /// </summary> /// <param name="property">Must be a non-null storage property</param> /// <param name="theDefault">Optional facet</param> /// <param name="maxLength">Optional facet</param> /// <param name="fixedLength">Optional facet</param> /// <param name="precision">Optional facet</param> /// <param name="scale">Optional facet</param> /// <param name="unicode">Optional facet</param> /// <param name="collation">Optional facet</param> /// <param name="concurrencyMode">Optional facet</param> internal SetPropertyFacetsCommand( Property property, StringOrNone theDefault, StringOrPrimitive<UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive<UInt32> precision, StringOrPrimitive<UInt32> scale, BoolOrNone unicode, StringOrNone collation, string concurrencyMode) { CommandValidation.ValidateProperty(property); _property = property; _theDefault = theDefault; _maxLength = maxLength; _fixedLength = fixedLength; _precision = precision; _scale = scale; _unicode = unicode; _collation = collation; _concurrencyMode = concurrencyMode; }
private static Property CreateProperty( EntityType parentEntity, string name, string type, BoolOrNone isNullable, InsertPropertyPosition insertPosition) { var conceptualEntity = parentEntity as ConceptualEntityType; Debug.Assert(conceptualEntity != null || parentEntity is StorageEntityType, "unexpected entity type"); var property = conceptualEntity != null ? CreateConceptualProperty(conceptualEntity, name, type, insertPosition) : CreateStorageProperty((StorageEntityType)parentEntity, name, type); if (isNullable != null) { property.Nullable.Value = isNullable; } return(property); }
/// <summary> /// Change various aspects of the passed in Function Import. The passed in function import will be modified based on the /// other passed-in parameters (null is not ignored). /// </summary> /// <param name="ec"></param> /// <param name="fi"></param> /// <param name="function"></param> /// <param name="functionImportName"></param> /// <param name="prereqCommand"></param> internal ChangeFunctionImportCommand( ConceptualEntityContainer ec, FunctionImport fi, Function function, string functionImportName, BoolOrNone functionImportIsComposable, CreateComplexTypeCommand prereqCommand) { ValidatePrereqCommand(prereqCommand); CommandValidation.ValidateFunctionImport(fi); ValidateString(functionImportName); FunctionImport = fi; Function = function; EntityContainer = ec; FunctionImportName = functionImportName; FunctionImportIsComposable = functionImportIsComposable; ChangeReturnType = true; _efContainerToBeNormalized = new List <EFContainer>(); AddPreReqCommand(prereqCommand); }
/// <summary> /// Sets facets on the passed in property. /// </summary> /// <param name="property">Must be a non-null storage property</param> /// <param name="theDefault">Optional facet</param> /// <param name="maxLength">Optional facet</param> /// <param name="fixedLength">Optional facet</param> /// <param name="precision">Optional facet</param> /// <param name="scale">Optional facet</param> /// <param name="unicode">Optional facet</param> /// <param name="collation">Optional facet</param> /// <param name="concurrencyMode">Optional facet</param> internal SetPropertyFacetsCommand( Property property, StringOrNone theDefault, StringOrPrimitive <UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive <UInt32> precision, StringOrPrimitive <UInt32> scale, BoolOrNone unicode, StringOrNone collation, string concurrencyMode) { CommandValidation.ValidateProperty(property); _property = property; _theDefault = theDefault; _maxLength = maxLength; _fixedLength = fixedLength; _precision = precision; _scale = scale; _unicode = unicode; _collation = collation; _concurrencyMode = concurrencyMode; }
/// <summary> /// Change various aspects of the passed in Function Import. The passed in function import will be modified based on the /// other passed-in parameters (null is not ignored). /// </summary> /// <param name="ec"></param> /// <param name="fi"></param> /// <param name="function"></param> /// <param name="functionImportName"></param> /// <param name="prereqCommand"></param> internal ChangeFunctionImportCommand( ConceptualEntityContainer ec, FunctionImport fi, Function function, string functionImportName, BoolOrNone functionImportIsComposable, CreateComplexTypeCommand prereqCommand) { ValidatePrereqCommand(prereqCommand); CommandValidation.ValidateFunctionImport(fi); ValidateString(functionImportName); FunctionImport = fi; Function = function; EntityContainer = ec; FunctionImportName = functionImportName; FunctionImportIsComposable = functionImportIsComposable; ChangeReturnType = true; _efContainerToBeNormalized = new List<EFContainer>(); AddPreReqCommand(prereqCommand); }
/// <summary> /// Sets facets on the property being created by the passed in command. /// </summary> /// <param name="prereq">Must be non-null command creating the storage property</param> /// <param name="theDefault">Optional facet</param> /// <param name="maxLength">Optional facet</param> /// <param name="fixedLength">Optional facet</param> /// <param name="precision">Optional facet</param> /// <param name="scale">Optional facet</param> /// <param name="unicode">Optional facet</param> /// <param name="collation">Optional facet</param> /// <param name="concurrencyMode">Optional facet</param> internal SetPropertyFacetsCommand( CreatePropertyCommand prereq, StringOrNone theDefault, StringOrPrimitive<UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive<UInt32> precision, StringOrPrimitive<UInt32> scale, BoolOrNone unicode, StringOrNone collation, string concurrencyMode) { ValidatePrereqCommand(prereq); _theDefault = theDefault; _maxLength = maxLength; _fixedLength = fixedLength; _precision = precision; _scale = scale; _unicode = unicode; _collation = collation; _concurrencyMode = concurrencyMode; AddPreReqCommand(prereq); }
/// <summary> /// Creates a new property in the passed in storage 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 storage 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="maxLength">Optional facet</param> /// <param name="fixedLength">Optional facet</param> /// <param name="precision">Optional facet</param> /// <param name="scale">Optional facet</param> /// <param name="unicode">Optional facet</param> /// <param name="collation">Optional facet</param> /// <param name="concurrencyMode">Optional: the concurrency mode for this property</param> /// <returns>The new Property</returns> internal static Property CreateStorageProperty( CommandProcessorContext cpc, string name, StorageEntityType entityType, string type, bool?nullable, StringOrNone theDefault, StringOrPrimitive <UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive <UInt32> precision, StringOrPrimitive <UInt32> scale, BoolOrNone unicode, StringOrNone collation, string concurrencyMode) { CommandValidation.ValidateStorageEntityType(entityType); var cpcd = new CreatePropertyCommand(name, entityType, type, nullable); var ssp = new SetPropertyFacetsCommand( cpcd, theDefault, maxLength, fixedLength, precision, scale, unicode, collation, concurrencyMode); var cp = new CommandProcessor(cpc, cpcd, ssp); cp.Invoke(); return(cpcd.CreatedProperty); }
/// <summary> /// Sets facets on the property being created by the passed in command. /// </summary> /// <param name="prereq">Must be non-null command creating the storage property</param> /// <param name="theDefault">Optional facet</param> /// <param name="maxLength">Optional facet</param> /// <param name="fixedLength">Optional facet</param> /// <param name="precision">Optional facet</param> /// <param name="scale">Optional facet</param> /// <param name="unicode">Optional facet</param> /// <param name="collation">Optional facet</param> /// <param name="concurrencyMode">Optional facet</param> internal SetPropertyFacetsCommand( CreateComplexTypePropertyCommand prereq, StringOrNone theDefault, StringOrPrimitive <UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive <UInt32> precision, StringOrPrimitive <UInt32> scale, BoolOrNone unicode, StringOrNone collation, string concurrencyMode) { ValidatePrereqCommand(prereq); _theDefault = theDefault; _maxLength = maxLength; _fixedLength = fixedLength; _precision = precision; _scale = scale; _unicode = unicode; _collation = collation; _concurrencyMode = concurrencyMode; AddPreReqCommand(prereq); }
/// <summary> /// Creates a new property in the passed in storage 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 storage 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="maxLength">Optional facet</param> /// <param name="fixedLength">Optional facet</param> /// <param name="precision">Optional facet</param> /// <param name="scale">Optional facet</param> /// <param name="unicode">Optional facet</param> /// <param name="collation">Optional facet</param> /// <param name="concurrencyMode">Optional: the concurrency mode for this property</param> /// <returns>The new Property</returns> internal static Property CreateStorageProperty( CommandProcessorContext cpc, string name, StorageEntityType entityType, string type, bool? nullable, StringOrNone theDefault, StringOrPrimitive<UInt32> maxLength, BoolOrNone fixedLength, StringOrPrimitive<UInt32> precision, StringOrPrimitive<UInt32> scale, BoolOrNone unicode, StringOrNone collation, string concurrencyMode) { CommandValidation.ValidateStorageEntityType(entityType); var cpcd = new CreatePropertyCommand(name, entityType, type, nullable); var ssp = new SetPropertyFacetsCommand( cpcd, theDefault, maxLength, fixedLength, precision, scale, unicode, collation, concurrencyMode); var cp = new CommandProcessor(cpc, cpcd, ssp); cp.Invoke(); return cpcd.CreatedProperty; }
private static Property CreateProperty( EntityType parentEntity, string name, string type, BoolOrNone isNullable, InsertPropertyPosition insertPosition) { var conceptualEntity = parentEntity as ConceptualEntityType; Debug.Assert(conceptualEntity != null || parentEntity is StorageEntityType, "unexpected entity type"); var property = conceptualEntity != null ? CreateConceptualProperty(conceptualEntity, name, type, insertPosition) : CreateStorageProperty((StorageEntityType)parentEntity, name, type); if (isNullable != null) { property.Nullable.Value = isNullable; } return property; }