/// <summary> /// Asserts that the definition is valid. /// </summary> /// <param name="entityType"></param> /// <param name="name"></param> /// <param name="nativeName"></param> /// <param name="type"></param> /// <param name="size"></param> /// <param name="multiValue"></param> public virtual void AssertDefinition(EntityType entityType, string name, string nativeName, ExtendedPropertyDataType dataType, long size, bool multiValue) { }
public ExtendedPropertyDefinition CreateProperty(EntityType entityType, string name, ExtendedPropertyDataType dataType, long size, bool multiValue) { if (entityType == null) { throw new ArgumentNullException("entityType"); } if (name == null) { throw new ArgumentNullException("name"); } if (name.Length == 0) { throw new ArgumentOutOfRangeException("'name' is zero-length."); } // get... string nativeName = SuggestNativeName(entityType, name); if (nativeName == null) { throw new InvalidOperationException("'nativeName' is null."); } if (nativeName.Length == 0) { throw new InvalidOperationException("'nativeName' is zero-length."); } // defer... return(this.CreateProperty(entityType, name, nativeName, dataType, size, multiValue)); }
public ExtendedPropertyDefinition CreateProperty(EntityType entityType, string name, string nativeName, ExtendedPropertyDataType dataType, long size, bool multiValue) { if (entityType == null) { throw new ArgumentNullException("entityType"); } if (name == null) { throw new ArgumentNullException("name"); } if (name.Length == 0) { throw new ArgumentOutOfRangeException("'name' is zero-length."); } if (nativeName == null) { throw new ArgumentNullException("nativeName"); } if (nativeName.Length == 0) { throw new ArgumentOutOfRangeException("'nativeName' is zero-length."); } if (nativeName.Length > DatabaseExtensibilityProvider.MaxNativeNameLength) { throw new ArgumentException(string.Format("Native name '{0}' is {1} characters in length and the maximum is {2} characters.", nativeName, nativeName.Length, DatabaseExtensibilityProvider.MaxNativeNameLength)); } if (dataType == null) { throw new ArgumentNullException("dataType"); } // mbr - 25-09-2007 - check with provider... if (Database.ExtensibilityProvider == null) { throw new InvalidOperationException("Database.ExtensibilityProvider is null."); } Database.ExtensibilityProvider.AssertDefinition(entityType, name, nativeName, dataType, size, multiValue); // is it a legal name? EntityType.AssertIsLegalIdentifierName(nativeName); // do we already have it? ExtendedPropertyDefinition existing = this.Properties[entityType.Id, nativeName]; if (existing != null) { throw new InvalidOperationException(string.Format("'{0}' already has a property called '{1}' (name).", entityType.Name, nativeName)); } // mbr - 12-12-2005 - other check for the display name... existing = this.Properties.GetByName(entityType.Id, name, false); if (existing != null) { throw new InvalidOperationException(string.Format("'{0}' already has a property called '{1}' (display name).", entityType.Name, name)); } // create it... ExtendedPropertyDefinition prop = new ExtendedPropertyDefinition(name, nativeName, dataType, entityType.Id); prop.Size = size; // check... if (dataType.SupportsMultiValue && multiValue) { prop.MultiValue = true; } else { prop.MultiValue = false; } // add... this.Properties.Add(prop); // mbr - 02-10-2007 - for c7 - we don't want to do this here because it will frankly take too // long. do it later... // EnsureExtendedTableUpToDate(entityType); // return... return(prop); }
/// <summary> /// Initializes a new <see cref="ExtendedPropertyId"/> instance. /// </summary> /// <param name="dataType">The data type of the ID.</param> /// <param name="namespaceId">The GUID of the ID's namespace.</param> /// <param name="name">The name of the ID.</param> public ExtendedPropertyId(ExtendedPropertyDataType dataType, Guid namespaceId, string name) { this.DataType = dataType; this.NamespaceId = namespaceId; this.Name = name; }