Class ForeignKey

Namespace
DbExport.Schema
Assembly
DbExport.Api.dll

Represents a foreign key constraint in a database schema. This class provides details about the referenced table, the columns involved, and the actions to take on update or delete.

public class ForeignKey : Key, IVisitorAcceptor, ICheckable
Inheritance
ForeignKey
Implements
Inherited Members

Constructors

ForeignKey(Table, string, IEnumerable<string>, string, string, string[], ForeignKeyRule, ForeignKeyRule)

Initializes a new instance of the ForeignKey class.

public ForeignKey(Table table, string name, IEnumerable<string> columnNames, string relatedName, string relatedOwner, string[] relatedColumns, ForeignKeyRule updateRule, ForeignKeyRule deleteRule)

Parameters

table Table

The table that owns the foreign key.

name string

The name of the foreign key constraint.

columnNames IEnumerable<string>

The names of the columns that make up the foreign key.

relatedName string

The name of the referenced table.

relatedOwner string

The owner of the referenced table.

relatedColumns string[]

The names of the columns in the referenced table.

updateRule ForeignKeyRule

The action to take on update.

deleteRule ForeignKeyRule

The action to take on delete.

Properties

DeleteRule

Gets the action to take on delete.

public ForeignKeyRule DeleteRule { get; }

Property Value

ForeignKeyRule

RelatedColumnNames

Gets the names of the columns in the referenced table.

public string[] RelatedColumnNames { get; }

Property Value

string[]

RelatedTable

Gets a reference to the referenced table if loaded in the imported database schema, otherwise null.

public Table RelatedTable { get; }

Property Value

Table

RelatedTableFullName

Gets the fully qualified name of the referenced table.

public string RelatedTableFullName { get; }

Property Value

string

RelatedTableName

Gets the name of the referenced table.

public string RelatedTableName { get; }

Property Value

string

RelatedTableOwner

Gets the owner of the referenced table.

public string RelatedTableOwner { get; }

Property Value

string

UpdateRule

Gets the action to take on update.

public ForeignKeyRule UpdateRule { get; }

Property Value

ForeignKeyRule

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.

GetRelatedColumn(int)

Retrieves the related column based on the specified index in the foreign key relationship.

public Column GetRelatedColumn(int i)

Parameters

i int

The zero-based index of the related column in the foreign key relationship.

Returns

Column

The Column object corresponding to the specified index, or null if the related table or column is not found.