Class ForeignKeySchema
The schema of the foreign key of the database table.
Inheritance
Namespace: Kros.Data.Schema
Assembly: Kros.Utils.dll
Syntax
public class ForeignKeySchema
Constructors
ForeignKeySchema(String, String, IEnumerable<String>, String, IEnumerable<String>)
Creates a definition of foreign key with the name.
Columns primaryKeyTableColumns in parent table primaryKeyTableName are
referenced in columns foreignKeyTableColumns of child table foreignKeyTableName.
Declaration
public ForeignKeySchema(string name, string primaryKeyTableName, IEnumerable<string> primaryKeyTableColumns, string foreignKeyTableName, IEnumerable<string> foreignKeyTableColumns)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the foreign key. |
| System.String | primaryKeyTableName | |
| System.Collections.Generic.IEnumerable<System.String> | primaryKeyTableColumns | List of columns in parent table. |
| System.String | foreignKeyTableName | |
| System.Collections.Generic.IEnumerable<System.String> | foreignKeyTableColumns | List of columns in child table. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Value of any argument is null. |
| System.ArgumentException |
ForeignKeySchema(String, String, String, String, String)
Creates a definition of foreign key with the name.
Column primaryKeyTableColumn in parent table primaryKeyTableName is
referenced in column foreignKeyTableColumn of child table foreignKeyTableName.
Declaration
public ForeignKeySchema(string name, string primaryKeyTableName, string primaryKeyTableColumn, string foreignKeyTableName, string foreignKeyTableColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the foreign key. |
| System.String | primaryKeyTableName | |
| System.String | primaryKeyTableColumn | Column name in primary key table. |
| System.String | foreignKeyTableName | |
| System.String | foreignKeyTableColumn | Column name in foreign key table. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Value of any parameter is null. |
| System.ArgumentException | Value of any parameter is empty string, or string containing only whitespace characters. |
Properties
DeleteRule
The rule, what to do when record in parent table is deleted.
Declaration
public ForeignKeyRule DeleteRule { get; set; }
Property Value
| Type | Description |
|---|---|
| ForeignKeyRule |
ForeignKeyTableColumns
List of columns in child table.
Declaration
public ReadOnlyCollection<string> ForeignKeyTableColumns { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ReadOnlyCollection<System.String> |
ForeignKeyTableName
Name of the child table.
Declaration
public string ForeignKeyTableName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Name
Name of the foreign key.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
PrimaryKeyTableColumns
List of columns in primary key table.
Declaration
public ReadOnlyCollection<string> PrimaryKeyTableColumns { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ReadOnlyCollection<System.String> |
PrimaryKeyTableName
Name of the table, where the primary key is.
Declaration
public string PrimaryKeyTableName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Table
Table to which this foreign key belongs.
Declaration
public TableSchema Table { get; }
Property Value
| Type | Description |
|---|---|
| TableSchema |
UpdateRule
The rule, what to do when record in parent table is updated.
Declaration
public ForeignKeyRule UpdateRule { get; set; }
Property Value
| Type | Description |
|---|---|
| ForeignKeyRule |
Methods
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |