Class Table

Namespace
DbExport.Schema
Assembly
DbExport.Api.dll

Represents a database table, which is a specialized ColumnSet containing columns, constraints, and relationships to other tables.

public class Table : ColumnSet, IVisitorAcceptor, ICheckable
Inheritance
Table
Implements
Inherited Members
Extension Methods

Remarks

The Table class extends the ColumnSet class to provide additional functionality specific to database tables, such as primary key generation, foreign key constraints, and referencing tables.

Constructors

Table(Database, string, string)

Represents a database table, which is a specialized ColumnSet containing columns, constraints, and relationships to other tables.

public Table(Database db, string name, string owner)

Parameters

db Database

The database that owns the table.

name string

The name of the table.

owner string

The owner of the table.

Remarks

The Table class extends the ColumnSet class to provide additional functionality specific to database tables, such as primary key generation, foreign key constraints, and referencing tables.

Properties

Database

The database that owns the table.

public Database Database { get; }

Property Value

Database

ForeignKeys

The foreign keys of the table.

public ForeignKeyCollection ForeignKeys { get; }

Property Value

ForeignKeyCollection

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

HasForeignKey

Indicates whether the table has a foreign key.

public bool HasForeignKey { get; }

Property Value

bool

HasIndex

Indicates whether the table has an index.

public bool HasIndex { get; }

Property Value

bool

HasPrimaryKey

Indicates whether the table has a primary key.

public bool HasPrimaryKey { get; }

Property Value

bool

Indexes

The indexes of the table.

public IndexCollection Indexes { get; }

Property Value

IndexCollection

NonFKColumns

Gets the columns of the table that are not foreign key columns.

public ColumnCollection NonFKColumns { get; }

Property Value

ColumnCollection

NonKeyColumns

Gets the columns of the table that are neither primary key nor foreign key columns.

public ColumnCollection NonKeyColumns { get; }

Property Value

ColumnCollection

NonPKColumns

Gets the columns of the table that are not primary key columns.

public ColumnCollection NonPKColumns { get; }

Property Value

ColumnCollection

Owner

The owner of the table.

public string Owner { get; }

Property Value

string

PrimaryKey

The primary key of the table.

public PrimaryKey PrimaryKey { get; }

Property Value

PrimaryKey

ReferencedTables

Gets a collection of tables that are referenced by foreign keys in this table.

public TableCollection ReferencedTables { get; }

Property Value

TableCollection

ReferencingTables

Gets a collection of tables that are referencing this table through foreign keys.

public TableCollection ReferencingTables { get; }

Property Value

TableCollection

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.

GeneratePrimaryKey(string, IEnumerable<string>)

Creates a primary key for the table using the specified name and column names.

public void GeneratePrimaryKey(string name, IEnumerable<string> columnNames)

Parameters

name string

The name of the primary key to be created.

columnNames IEnumerable<string>

A collection of column names that will be included in the primary key.

GetReferencingKey(Table)

Retrieves the foreign key in the current table that references the specified table.

public ForeignKey GetReferencingKey(Table table)

Parameters

table Table

The table being referenced by the foreign key.

Returns

ForeignKey

The foreign key that references the specified table, or null if no such key exists.

IsAssociationTable()

Determines whether the table is an association table. An association table is identified as having more than one referenced table, and all its columns are either foreign key columns or generated columns.

public bool IsAssociationTable()

Returns

bool

True if the table is an association table; otherwise, false.