/// <summary> /// Override so we can specify explicit db type's on any property types that are built-in. /// </summary> /// <param name="propertyEditorAlias"></param> /// <param name="storageType"></param> /// <param name="propertyTypeAlias"></param> /// <returns></returns> protected override PropertyType CreatePropertyType(string propertyEditorAlias, ValueStorageType storageType, string propertyTypeAlias) { //custom property type constructor logic to set explicit dbtype's for built in properties var builtinProperties = ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper); var readonlyStorageType = builtinProperties.TryGetValue(propertyTypeAlias, out var propertyType); storageType = readonlyStorageType ? propertyType.ValueStorageType : storageType; return(new PropertyType(_shortStringHelper, propertyEditorAlias, storageType, readonlyStorageType, propertyTypeAlias)); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyType"/> class. /// </summary> public PropertyType(string propertyEditorAlias, ValueStorageType valueStorageType, string propertyTypeAlias) : this(propertyEditorAlias, valueStorageType, false, propertyTypeAlias) { }
/// <summary> /// Initializes a new instance of the <see cref="PropertyType" /> class. /// </summary> public PropertyType(IShortStringHelper shortStringHelper, string propertyEditorAlias, ValueStorageType valueStorageType, string propertyTypeAlias) : this(shortStringHelper, propertyEditorAlias, valueStorageType, false, propertyTypeAlias) { }
/// <summary> /// Initializes a new instance of the <see cref="PropertyType" /> class. /// </summary> /// <remarks> /// Set <paramref name="forceValueStorageType" /> to true to force the value storage type. Values assigned to /// the property, eg from the underlying datatype, will be ignored. /// </remarks> public PropertyType(IShortStringHelper shortStringHelper, string propertyEditorAlias, ValueStorageType valueStorageType, bool forceValueStorageType, string?propertyTypeAlias = null) { _shortStringHelper = shortStringHelper; _propertyEditorAlias = propertyEditorAlias; _valueStorageType = valueStorageType; _forceValueStorageType = forceValueStorageType; _alias = propertyTypeAlias == null ? string.Empty : SanitizeAlias(propertyTypeAlias); _variations = ContentVariation.Nothing; _name = string.Empty; }
/// <summary> /// Override so we can specify explicit db type's on any property types that are built-in. /// </summary> /// <param name="propertyEditorAlias"></param> /// <param name="dbType"></param> /// <param name="propertyTypeAlias"></param> /// <returns></returns> protected override PropertyType CreatePropertyType(string propertyEditorAlias, ValueStorageType dbType, string propertyTypeAlias) { //custom property type constructor logic to set explicit dbtype's for built in properties var stdProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); var propDbType = GetDbTypeForBuiltInProperty(propertyTypeAlias, dbType, stdProps); return(new PropertyType(propertyEditorAlias, propDbType.Result, //This flag tells the property type that it has an explicit dbtype and that it cannot be changed // which is what we want for the built-in properties. propDbType.Success, propertyTypeAlias)); }