//============================ PropertyType assignment public abstract void AddPropertyTypeToPropertySet(PropertyType propertyType, PropertySet owner, bool isDeclared);
/// <summary> /// When overridden in a derived class, removes the PropertyType from the owner PropertySet and resets the /// property values into all nodes instatiated by passed PropertySet. /// </summary> /// <param name="propertyType">PropertyType to remove</param> /// <param name="owner">Owner PropertySet</param> public abstract void RemovePropertyTypeFromPropertySet(PropertyType propertyType, PropertySet owner);
public void AddPropertyTypeToPropertySet(PropertyType propertyType, PropertySet owner, bool isDeclared) { _target.GetType().GetMethod("AddPropertyTypeToPropertySet").Invoke(_target, new object[] { propertyType, owner, isDeclared }); }
public void RemovePropertyTypeFromPropertySet(PropertyType propertyType, PropertySet owner) { _target.GetType().GetMethod("RemovePropertyTypeFromPropertySet").Invoke(_target, new object[] { propertyType, owner }); }
private void WriteResetPropertyScript(StringBuilder scriptBuilder, PropertySet nodeType, PropertyType slot) { string comment = CreateCommentLine("Reset property value: ", nodeType.Name, ".", slot.Name, ":", slot.DataType); switch (slot.DataType) { case DataType.String: WriteResetPropertySlotScript(scriptBuilder, nodeType.Id, slot.Mapping, SqlProvider.StringMappingPrefix, SqlProvider.StringPageSize, comment); //WriteDeletePropertyScript(nodeType.Id, slot.Id, "TextPropertiesNVarchar", "TextPropertyNVarcharId"); break; case DataType.Int: WriteResetPropertySlotScript(scriptBuilder, nodeType.Id, slot.Mapping, SqlProvider.IntMappingPrefix, SqlProvider.IntPageSize, comment); break; case DataType.Currency: WriteResetPropertySlotScript(scriptBuilder, nodeType.Id, slot.Mapping, SqlProvider.CurrencyMappingPrefix, SqlProvider.CurrencyPageSize, comment); break; case DataType.DateTime: WriteResetPropertySlotScript(scriptBuilder, nodeType.Id, slot.Mapping, SqlProvider.DateTimeMappingPrefix, SqlProvider.DateTimePageSize, comment); break; case DataType.Binary: WriteDeletePropertyScript(scriptBuilder, nodeType.Id, slot.Id, "BinaryProperties", "BinaryPropertyId", comment); break; case DataType.Text: WriteDeletePropertyScript(scriptBuilder, nodeType.Id, slot.Id, "TextPropertiesNVarchar", "TextPropertyNVarcharId", comment); WriteDeletePropertyScript(scriptBuilder, nodeType.Id, slot.Id, "TextPropertiesNText", "TextPropertyNTextId", comment); break; case DataType.Reference: WriteDeletePropertyScript(scriptBuilder, nodeType.Id, slot.Id, "ReferenceProperties", "ReferencePropertyId", comment); break; default: break; } }
public override void RemovePropertyTypeFromPropertySet(PropertyType propertyType, PropertySet owner) { StringBuilder sb = new StringBuilder(); if (propertyType == null) throw new ArgumentNullException("propertyType"); if (owner == null) throw new ArgumentNullException("owner"); WriteResetPropertyScript(sb, owner, propertyType); sb.Append(CreateCommentLine("Remove PropertyType '", propertyType.Name, "' from PropertySet '", owner.Name, "'")); sb.Append("DELETE FROM [dbo].[SchemaPropertySetsPropertyTypes] WHERE PropertyTypeId = "); sb.Append(propertyType.Id); sb.Append(" AND PropertySetId = "); sb.Append(owner.Id).AppendLine(); AddScript(sb); }
public override void AddPropertyTypeToPropertySet(PropertyType propertyType, PropertySet owner, bool isDeclared) { StringBuilder sb = new StringBuilder(); if (propertyType == null) throw new ArgumentNullException("propertyType"); if (owner == null) throw new ArgumentNullException("owner"); sb.Append(CreateCommentLine("Add PropertyType to PropertySet (", owner.Name, ".", propertyType.Name, " : ", propertyType.DataType, ")")); DeclareIntVariable(sb, "propertyTypeId"); sb.Append("SELECT @propertyTypeId = [PropertyTypeId] FROM [dbo].[SchemaPropertyTypes] WHERE [Name] = '").Append(propertyType.Name).Append("'").AppendLine(); DeclareIntVariable(sb, "ownerId"); sb.Append("SELECT @ownerId = [PropertySetId] FROM [dbo].[SchemaPropertySets] WHERE [Name] = '").Append(owner.Name).Append("'").AppendLine(); WriteInsertScript(sb, "SchemaPropertySetsPropertyTypes", null, "PropertyTypeId", "@propertyTypeId", "PropertySetId", "@ownerId", "IsDeclared", isDeclared ? 1 : 0 ); AddScript(sb); }
public void RemovePropertyTypeFromPropertySet(PropertyType propertyType, PropertySet owner) { if (propertyType == null) throw new ArgumentNullException("propertyType"); if (owner == null) throw new ArgumentNullException("owner"); if (propertyType.SchemaRoot != this) throw new InvalidSchemaException(SR.Exceptions.Schema.Msg_InconsistentHierarchy); if (owner.SchemaRoot != this) throw new InvalidSchemaException(SR.Exceptions.Schema.Msg_InconsistentHierarchy); owner.RemovePropertyType(propertyType); if(!IsUsedPropertyType(propertyType)) DeletePropertyType(propertyType); }
public void AddPropertyTypeToPropertySet(PropertyType propertyType, PropertySet owner) { if (propertyType == null) throw new ArgumentNullException("propertyType"); if (owner == null) throw new ArgumentNullException("owner"); if (propertyType.SchemaRoot != this) throw new InvalidSchemaException(SR.Exceptions.Schema.Msg_InconsistentHierarchy); if (owner.SchemaRoot != this) throw new InvalidSchemaException(SR.Exceptions.Schema.Msg_InconsistentHierarchy); owner.AddPropertyType(propertyType); }