Class ForeignKeySchemaCollection
List of foreign keys for table TableSchema.
Inheritance
Namespace: Kros.Data.Schema
Assembly: Kros.Utils.dll
Syntax
public class ForeignKeySchemaCollection : KeyedCollection<string, ForeignKeySchema>, IList<ForeignKeySchema>, ICollection<ForeignKeySchema>, IList, ICollection, IReadOnlyList<ForeignKeySchema>, IReadOnlyCollection<ForeignKeySchema>, IEnumerable<ForeignKeySchema>, IEnumerable
Remarks
To the foreign keys added to this list is automatically set their Table. Foreign key can belong only to one table.
Constructors
ForeignKeySchemaCollection(TableSchema)
Creates a new foreign key list for table
.
Declaration
public ForeignKeySchemaCollection(TableSchema table)
Parameters
Type | Name | Description |
---|---|---|
TableSchema | table | Table to which foreign key list belongs. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Value of |
Methods
Add(String, String, IEnumerable<String>, String, IEnumerable<String>)
Creates a definition of foreign key with the name
and adds it to the list.
Columns primaryKeyTableColumns
in parent table primaryKeyTableName
are
referenced in columns foreignKeyTableColumns
of child table foreignKeyTableName
.
Declaration
public ForeignKeySchema Add(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. |
Returns
Type | Description |
---|---|
ForeignKeySchema |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Value of any argument is null. |
System.ArgumentException |
Add(String, String, String, String, String)
Creates a definition of foreign key with the name
and adds it to the list.
Column primaryKeyTableColumn
in parent table primaryKeyTableName
is
referenced in column foreignKeyTableColumn
of child table foreignKeyTableName
.
Declaration
public ForeignKeySchema Add(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. |
Returns
Type | Description |
---|---|
ForeignKeySchema | Created foreign key. |
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. |
GetKeyForItem(ForeignKeySchema)
Declaration
protected override string GetKeyForItem(ForeignKeySchema item)
Parameters
Type | Name | Description |
---|---|---|
ForeignKeySchema | item |
Returns
Type | Description |
---|---|
System.String |
Overrides
InsertItem(Int32, ForeignKeySchema)
Declaration
protected override void InsertItem(int index, ForeignKeySchema item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
ForeignKeySchema | item |
Overrides
RemoveItem(Int32)
Declaration
protected override void RemoveItem(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |