Class TableSchema
Schema of a database table.
Inheritance
Namespace: Kros.Data.Schema
Assembly: Kros.Utils.dll
Syntax
public class TableSchema
Constructors
TableSchema(DatabaseSchema, String)
Creates an instance of TableSchema
with specified name
,
which belongs to database
.
Declaration
public TableSchema(DatabaseSchema database, string name)
Parameters
Type | Name | Description |
---|---|---|
DatabaseSchema | database | Database into which table belongs to. Value can be null. |
System.String | name | Table's name. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Value of |
System.ArgumentException | Value of |
TableSchema(String)
Creates an instance of TableSchema
with specified name
.
Declaration
public TableSchema(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Meno tabuľky. Je povinné. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Value of |
System.ArgumentException | Value of |
Properties
Columns
Columns of the table.
Declaration
public ColumnSchemaCollection Columns { get; }
Property Value
Type | Description |
---|---|
ColumnSchemaCollection |
Database
Database to which table belongs.
Declaration
public DatabaseSchema Database { get; }
Property Value
Type | Description |
---|---|
DatabaseSchema |
ForeignKeys
List of table's foreign keys.
Declaration
public ForeignKeySchemaCollection ForeignKeys { get; }
Property Value
Type | Description |
---|---|
ForeignKeySchemaCollection |
Indexes
List of table's indexes.
Declaration
public IndexSchemaCollection Indexes { get; }
Property Value
Type | Description |
---|---|
IndexSchemaCollection |
Name
Table's name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
PrimaryKey
Table's primary key.
Declaration
public IndexSchema PrimaryKey { get; }
Property Value
Type | Description |
---|---|
IndexSchema |
Remarks
If table does not have a primary key, value is null.
Methods
SetPrimaryKey(String, Boolean)
Sets primary key with name primaryKeyName
and flag clustered
.
Declaration
public IndexSchema SetPrimaryKey(string primaryKeyName, bool clustered)
Parameters
Type | Name | Description |
---|---|---|
System.String | primaryKeyName | Primary key name. |
System.Boolean | clustered | If true, primary key is |
Returns
Type | Description |
---|---|
IndexSchema | Created primary key or null value, if primary key name was not specified. |
Remarks
If primaryKeyName
is null or empty string or white space string,
primary key is removed (value of PrimaryKey will be null).
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |