Class DataType

Namespace
DbExport.Schema
Assembly
DbExport.Api.dll

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

database Database

The parent Database object associated with the data type.

name string

The name of the data type.

owner string

The owning schema or namespace of the data type.

type ColumnType

The column type, specified as an enum of ColumnType.

nativeType string

The native database-specific type definition.

size short

The size of the data type, typically applicable for text or binary data.

precision byte

The precision value, applicable for numeric types.

scale byte

The scale value, applicable for numeric types with fractional parts.

nullable bool

Indicates whether the data type is nullable.

enumerated bool

Indicates whether the data type is an enumerated (enum) type.

defaultValue object

The default value of the data type, if any.

possibleValues IEnumerable<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

ColumnType

Database

The database that owns the data type.

public Database Database { get; }

Property Value

Database

DefaultValue

The default value of the data type, if any.

public object DefaultValue { get; }

Property Value

object

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

string

IsChecked

Gets or sets a value indicating whether the item is checked.

public bool IsChecked { get; set; }

Property Value

bool

IsEnumerated

Indicates whether the data type is an enumerated (enum) type.

public bool IsEnumerated { get; }

Property Value

bool

IsNullable

Indicates whether the data type is nullable.

public bool IsNullable { get; }

Property Value

bool

IsRequired

Gets a value indicating whether the data type is required.

public bool IsRequired { get; }

Property Value

bool

NativeType

The native database-specific type definition.

public string NativeType { get; }

Property Value

string

Owner

The owner of the data type.

public string Owner { get; }

Property Value

string

PossibleValues

A collection of possible values for the data type, if it is enumerated.

public ImmutableHashSet<object> PossibleValues { get; }

Property Value

ImmutableHashSet<object>

Precision

The decimal precision of the data type.

public byte Precision { get; }

Property Value

byte

Scale

The decimal scale of the data type.

public byte Scale { get; }

Property Value

byte

Size

The size (or character length) of the data type.

public short Size { get; }

Property Value

short

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

visitor IVisitor

The visitor instance that will perform operations on the implementing class.