Class DataType
- Namespace
- CMS.DataEngine
- Assembly
- CMS.DataEngine.dll
Data type definition
public abstract class DataType
- Inheritance
-
objectDataType
- Derived
- Extension Methods
Fields
mTextSerializer
Serializer used to serialize and deserialize values of this data type.
protected IDataTypeTextSerializer mTextSerializer
Field Value
Properties
AllowEmpty
If true, the data type allows for nulls in the database
public bool AllowEmpty { get; set; }
Property Value
- bool
CodeValueFormat
Formatting code of the value for this type
public string CodeValueFormat { get; set; }
Property Value
- string
ConversionMethod
Returns the conversion method
public abstract string ConversionMethod { get; set; }
Property Value
- string
DbType
Database type
public object DbType { get; set; }
Property Value
- object
DefaultPrecision
Default precision of the type, if the precision is variable
public int DefaultPrecision { get; set; }
Property Value
- int
DefaultSize
Default size of the type, if the size is variable
public int DefaultSize { get; set; }
Property Value
- int
DefaultValueCode
Code of the default value for this type
public abstract string DefaultValueCode { get; set; }
Property Value
- string
FieldType
Field type
public string FieldType { get; protected set; }
Property Value
- string
GetFormatProvider
Function which gets a format provider for the given culture
public Func<CultureInfo, IFormatProvider> GetFormatProvider { get; set; }
Property Value
- Func<CultureInfo, IFormatProvider>
HasConfigurableDefaultValue
Returns true if the type has a default value
public bool HasConfigurableDefaultValue { get; set; }
Property Value
- bool
Hidden
If true, the data type is hidden
public bool Hidden { get; set; }
Property Value
- bool
IsAvailableForDataClass
Predicate used to determine whether the data type should be available for a given DataClassInfo.
public Predicate<DataClassInfo> IsAvailableForDataClass { get; set; }
Property Value
- Predicate<DataClassInfo>
IsDefaultType
If true, the data type is considered default. Types marked as default are replaced only by default types in the type mapping tables.
public bool IsDefaultType { get; set; }
Property Value
- bool
MaxPrecision
Maximum precision of the type, if the precision is variable
public int MaxPrecision { get; set; }
Property Value
- int
MaxSize
Maximum size of the type, if the size is variable
public int MaxSize { get; set; }
Property Value
- int
MaxValueLength
Maximum value length
public int MaxValueLength { get; set; }
Property Value
- int
ObjectDefaultValue
Default value for this data type
public abstract object ObjectDefaultValue { get; }
Property Value
- object
SchemaType
Type representation in the XML schema of the data
public string SchemaType { get; protected set; }
Property Value
- string
SpecialDefaultValues
List of special default values recognized by this type and treated as default value by the code
public List<string> SpecialDefaultValues { get; set; }
Property Value
- List<string>
SqlType
SQL data type representation
public string SqlType { get; protected set; }
Property Value
- string
SqlValueFormat
SQL value format. Default format is '{0}' to prevent SQL injection
public string SqlValueFormat { get; set; }
Property Value
- string
StringFormat
If defined, the given format is used to convert the value of this type to a string value. {0} represents the value.
public string StringFormat { get; set; }
Property Value
- string
TextSerializer
Gets the IDataTypeTextSerializer instance for this data type.
public virtual IDataTypeTextSerializer TextSerializer { get; }
Property Value
Type
System type
public Type Type { get; protected set; }
Property Value
- Type
TypeAlias
System type alias (e.g. bool for Boolean, etc.)
public string TypeAlias { get; set; }
Property Value
- string
TypeGroup
Name of the group that groups together types with similar behavior, such as integer, decimal, string etc.
[Obsolete("Property was not intended for public use and will be removed.")]
[ObsoleteSince(30, 1)]
public string TypeGroup { get; set; }
Property Value
- string
TypeName
Represents database type name
public string TypeName { get; set; }
Property Value
- string
VariablePrecision
If true, the data type has variable precision
public bool VariablePrecision { get; set; }
Property Value
- bool
VariableSize
If true, the data type has variable size
public bool VariableSize { get; set; }
Property Value
- bool
Methods
Convert(object, CultureInfo, object)
Converts the value to a proper type
public abstract object Convert(object value, CultureInfo culture, object defaultValue)
Parameters
value
objectValue to convert
culture
CultureInfoCulture used for conversion of the type
defaultValue
objectDefault value to return in case the conversion fails
Returns
- object
ConvertToDbType(object, CultureInfo, object)
Converts the value to its database representation.
public virtual object ConvertToDbType(object value, CultureInfo culture, object defaultValue)
Parameters
value
objectValue to convert
culture
CultureInfoCulture used for conversion of the type
defaultValue
objectDefault value to return in case the conversion fails
Returns
- object
FormatValue(object, CultureInfo)
Formats the given value
protected virtual string FormatValue(object value, CultureInfo culture)
Parameters
value
objectValue to format
culture
CultureInfoCulture used for format
Returns
- string
GetDefaultValueCode(string, bool)
Gets the code for the default value of this type in C# code
public string GetDefaultValueCode(string explicitDefaultValue = null, bool returnEmpty = false)
Parameters
explicitDefaultValue
stringExplicit default value to use
returnEmpty
boolIf true, the method returns code even if default value representation is empty
Returns
- string
GetSqlType(int, int)
Gets the SQL data type representation
public string GetSqlType(int size, int precision)
Parameters
size
intData size
precision
intData precision
Returns
- string
GetSqlValue(object)
Gets the SQL value representation for this type
public string GetSqlValue(object value)
Parameters
value
objectValue to convert to SQL value
Returns
- string
GetString(object, CultureInfo)
Gets the string representation of the given value
public string GetString(object value, CultureInfo culture)
Parameters
value
objectValue to convert
culture
CultureInfoCulture used for conversion to string
Returns
- string
IsValueOfType(object, CultureInfo)
Determines whether given value
is of this data type.
public abstract bool IsValueOfType(object value, CultureInfo culture)
Parameters
value
objectObject to be tested.
culture
CultureInfoCulture to tests object for.
Returns
- bool
True if object is of this data type, otherwise returns false.