Class DataType
Represents a user-defined database data type with associated metadata such as size, precision, scale, and other characteristics.
public class DataType : SchemaItem, IVisitorAcceptor, IDataItem, ICheckable
- Inheritance
-
DataType
- Implements
- Inherited Members
Remarks
This class encapsulates schema metadata for a database column type. It holds information such as its owner,
size-related properties (size, precision, and scale), nullability, enumerated status, default value, and
possible values. The class extends SchemaItem and implements IDataItem and ICheckable.
Constructors
DataType(Database, string, string, ColumnType, string, short, byte, byte, bool, bool, object, IEnumerable<object>)
Represents a user-defined database data type with associated metadata such as size, precision, scale, and other characteristics.
public DataType(Database database, string name, string owner, ColumnType type, string nativeType, short size, byte precision, byte scale, bool nullable, bool enumerated, object defaultValue, IEnumerable<object> possibleValues)
Parameters
databaseDatabaseThe parent
Databaseobject associated with the data type.namestringThe name of the data type.
ownerstringThe owning schema or namespace of the data type.
typeColumnTypeThe column type, specified as an enum of
ColumnType.nativeTypestringThe native database-specific type definition.
sizeshortThe size of the data type, typically applicable for text or binary data.
precisionbyteThe precision value, applicable for numeric types.
scalebyteThe scale value, applicable for numeric types with fractional parts.
nullableboolIndicates whether the data type is nullable.
enumeratedboolIndicates whether the data type is an enumerated (enum) type.
defaultValueobjectThe default value of the data type, if any.
possibleValuesIEnumerable<object>A collection of possible values for the data type, if it is enumerated.
Remarks
This class encapsulates schema metadata for a database column type. It holds information such as its owner,
size-related properties (size, precision, and scale), nullability, enumerated status, default value, and
possible values. The class extends SchemaItem and implements IDataItem and ICheckable.
Properties
ColumnType
The column type of the data type.
public ColumnType ColumnType { get; }
Property Value
Database
The database that owns the data type.
public Database Database { get; }
Property Value
DefaultValue
The default value of the data type, if any.
public object DefaultValue { get; }
Property Value
FullName
Gets the fully qualified name of the schema item, which may include the owner or other contextual information, depending on the implementation of the derived class.
public override string FullName { get; }
Property Value
IsChecked
Gets or sets a value indicating whether the item is checked.
public bool IsChecked { get; set; }
Property Value
IsEnumerated
Indicates whether the data type is an enumerated (enum) type.
public bool IsEnumerated { get; }
Property Value
IsNullable
Indicates whether the data type is nullable.
public bool IsNullable { get; }
Property Value
IsRequired
Gets a value indicating whether the data type is required.
public bool IsRequired { get; }
Property Value
NativeType
The native database-specific type definition.
public string NativeType { get; }
Property Value
Owner
The owner of the data type.
public string Owner { get; }
Property Value
PossibleValues
A collection of possible values for the data type, if it is enumerated.
public ImmutableHashSet<object> PossibleValues { get; }
Property Value
Precision
The decimal precision of the data type.
public byte Precision { get; }
Property Value
Scale
The decimal scale of the data type.
public byte Scale { get; }
Property Value
Size
The size (or character length) of the data type.
public short Size { get; }
Property Value
Methods
AcceptVisitor(IVisitor)
Accepts a visitor, allowing it to perform operations on the implementing class. The visitor will typically have specific methods for handling different types of elements in the object structure.
public override void AcceptVisitor(IVisitor visitor)
Parameters
visitorIVisitorThe visitor instance that will perform operations on the implementing class.