Class Column

Namespace
DbExport.Schema
Assembly
DbExport.Api.dll

Represents a column in a database table with metadata and attributes that provide detailed information about its configuration and behavior within the schema.

public class Column : SchemaItem, IVisitorAcceptor, IDataItem, ICheckable
Inheritance
Column
Implements
Inherited Members

Remarks

The Column class captures information such as the type, size, precision, scale, attributes, and constraints of a database column. It includes properties that reflect specialized characteristics such as being a primary key, foreign key, computed column, or identity column. Additionally, it supports methods to manage its attributes or configure it as an identity column.

Constructors

Column(Table, string, ColumnType, string, short, byte, byte, ColumnAttributes, object, string)

Represents a column in a database table with metadata and attributes that provide detailed information about its configuration and behavior within the schema.

public Column(Table table, string name, ColumnType type, string nativeType, short size, byte precision, byte scale, ColumnAttributes attributes, object defaultValue, string description)

Parameters

table Table

The table to which this column belongs.

name string

The name of the column within the table.

type ColumnType

The logical type of the column, defined by ColumnType.

nativeType string

The database-specific type of the column as a string.

size short

The maximum size of the column's data in bytes or characters.

precision byte

The precision of the column, primarily used for numeric types.

scale byte

The scale (number of decimal places) of numeric types.

attributes ColumnAttributes

The attributes that describe the column's behavior and constraints.

defaultValue object

The default value defined for the column if no value is provided during insertion.

description string

The description or documentation of the column, often used for metadata purposes.

Remarks

The Column class captures information such as the type, size, precision, scale, attributes, and constraints of a database column. It includes properties that reflect specialized characteristics such as being a primary key, foreign key, computed column, or identity column. Additionally, it supports methods to manage its attributes or configure it as an identity column.

Properties

Attributes

Gets the attributes that describe the column's behavior and constraints.'

public ColumnAttributes Attributes { get; }

Property Value

ColumnAttributes

ColumnType

Gets the type of the column, which is defined by the ColumnType enumeration.

public ColumnType ColumnType { get; }

Property Value

ColumnType

DataType

Gets the definition of the column's data type if it's user-defined and available in imported schema.

public DataType DataType { get; }

Property Value

DataType

DefaultValue

Gets the default value defined for the column if no value is provided during insertion.

public object DefaultValue { get; }

Property Value

object

Description

Gets the description or documentation of the column, often used for metadata purposes.

public string Description { get; }

Property Value

string

IdentityIncrement

Gets or sets the increment value for the identity column.

public long IdentityIncrement { get; }

Property Value

long

IdentitySeed

Gets or sets the seed value for the identity column.

public long IdentitySeed { get; }

Property Value

long

IsAlphabetic

Gets a value indicating whether the column is of an alphabetic type.

public bool IsAlphabetic { get; }

Property Value

bool

IsBinary

Gets a value indicating whether the column is of a binary type.

public bool IsBinary { get; }

Property Value

bool

IsChecked

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

public bool IsChecked { get; set; }

Property Value

bool

IsComputed

Gets a value indicating whether the column is a computed column.

public bool IsComputed { get; }

Property Value

bool

IsFKColumn

Gets a value indicating whether the column is a foreign key column.

public bool IsFKColumn { get; }

Property Value

bool

IsFixedLength

Gets a value indicating whether the column is fixed-length.

public bool IsFixedLength { get; }

Property Value

bool

IsGenerated

Gets a value indicating whether the column is a row version column.

public bool IsGenerated { get; }

Property Value

bool

IsIdentity

Gets a value indicating whether the column is an identity column.

public bool IsIdentity { get; }

Property Value

bool

IsIndexColumn

Gets a value indicating whether the column is an index column.

public bool IsIndexColumn { get; }

Property Value

bool

IsIntegral

Gets a value indicating whether the column is of an integral type.

public bool IsIntegral { get; }

Property Value

bool

IsKeyColumn

Gets a value indicating whether the column is a key column.

public bool IsKeyColumn { get; }

Property Value

bool

IsNatural

Gets a value indicating whether the column is of a natural integer type, i.e., an unsigned integer

public bool IsNatural { get; }

Property Value

bool

IsNumeric

Gets a value indicating whether the column is of a numeric type.

public bool IsNumeric { get; }

Property Value

bool

IsPKColumn

Gets a value indicating whether the column is a primary key column.

public bool IsPKColumn { get; }

Property Value

bool

IsRequired

Gets a value indicating whether the column is nullable.

public bool IsRequired { get; }

Property Value

bool

IsTemporal

Gets a value indicating whether the column is of a temporal type.

public bool IsTemporal { get; }

Property Value

bool

IsUnicode

Gets a value indicating whether the column is of a Unicode type.

public bool IsUnicode { get; }

Property Value

bool

IsUnsigned

Gets a value indicating whether the column is of an unsigned integer type.

public bool IsUnsigned { get; }

Property Value

bool

NativeType

Gets the native type of the column as a string.

public string NativeType { get; }

Property Value

string

Precision

Gets the precision of the column, primarily used for numeric types.

public byte Precision { get; }

Property Value

byte

Scale

Gets the scale (number of decimal places) of numeric types.

public byte Scale { get; }

Property Value

byte

Size

Gets the size (or character length) of the column's data.'

public short Size { get; }

Property Value

short

Table

Gets the table to which this column belongs.

public Table Table { get; }

Property Value

Table

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.

MakeIdentity(long, long)

Configures the column as an identity column with a specified seed and increment.

public void MakeIdentity(long seed, long increment)

Parameters

seed long

The initial value of the identity column.

increment long

The step value used to increment the identity column.

SetAttribute(ColumnAttributes)

Sets the attribute of the column.

public void SetAttribute(ColumnAttributes attribute)

Parameters

attribute ColumnAttributes

The attribute to set.