Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
 /// <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)
 {
 }
Exemplo n.º 3
0
 /// <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)
 {
 }
Exemplo n.º 4
0
 /// <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;
 }
Exemplo n.º 5
0
        /// <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));
        }