目錄 / Table of Contents

Class OdfSchemaTable

Namespace
OdfKit.Database
Assembly
OdfKit.dll

Represents a table schema structure model. 表示資料表 Schema 結構模型。

public sealed class OdfSchemaTable
Inheritance
OdfSchemaTable
Inherited Members

Constructors

OdfSchemaTable(string)

Initializes a new instance of the OdfSchemaTable class. 初始化 OdfSchemaTable 類別的新執行個體。

public OdfSchemaTable(string name)

Parameters

name string

The table name. / 資料表名稱。

Exceptions

ArgumentException

When name is empty. / 當 name 為空時擲出。

Properties

Columns

Gets the list of table columns. 取得資料表欄位清單。

public IReadOnlyList<OdfSchemaColumn> Columns { get; }

Property Value

IReadOnlyList<OdfSchemaColumn>

ForeignKeys

Gets the list of foreign key relationship definitions of the table. 取得資料表的外鍵關聯定義清單。

public IReadOnlyList<OdfSchemaForeignKey> ForeignKeys { get; }

Property Value

IReadOnlyList<OdfSchemaForeignKey>

Indexes

Gets the list of index definitions of the table. 取得資料表的索引定義清單。

public IReadOnlyList<OdfSchemaIndex> Indexes { get; }

Property Value

IReadOnlyList<OdfSchemaIndex>

Name

Gets the table name. 取得資料表名稱。

public string Name { get; }

Property Value

string

PrimaryKey

Gets the primary key definition of the table. 取得資料表的主鍵定義。

public OdfSchemaPrimaryKey? PrimaryKey { get; }

Property Value

OdfSchemaPrimaryKey

Methods

AddColumn(OdfSchemaColumn)

Adds a column definition. 新增欄位定義。

public void AddColumn(OdfSchemaColumn column)

Parameters

column OdfSchemaColumn

The column definition. / 欄位定義。

Exceptions

ArgumentNullException

When column is null. / 當 columnnull 時擲出。

InvalidOperationException

When a column with the same name already exists. / 當同名欄位已存在時擲出。

AddForeignKey(OdfSchemaForeignKey)

Adds a foreign key definition. 新增外鍵定義。

public void AddForeignKey(OdfSchemaForeignKey foreignKey)

Parameters

foreignKey OdfSchemaForeignKey

The foreign key definition. / 外鍵定義。

Exceptions

ArgumentNullException

When foreignKey is null. / 當 foreignKeynull 時擲出。

InvalidOperationException

When a named foreign key with the same name already exists. / 當同名具名外鍵已存在時擲出。

AddIndex(OdfSchemaIndex)

Adds an index definition. 新增索引定義。

public void AddIndex(OdfSchemaIndex index)

Parameters

index OdfSchemaIndex

The index definition. / 索引定義。

Exceptions

ArgumentNullException

When index is null. / 當 indexnull 時擲出。

InvalidOperationException

When an index with the same name already exists. / 當同名索引已存在時擲出。

FindColumn(string)

Finds a column definition by name. 依名稱尋找欄位定義。

public OdfSchemaColumn? FindColumn(string name)

Parameters

name string

The column name. / 欄位名稱。

Returns

OdfSchemaColumn

The matching column, or null when it does not exist. / 符合的欄位;不存在時為 null

Exceptions

ArgumentException

When name is blank. / 當 name 為空白時擲出。

FindIndex(string)

Finds an index definition by name. 依名稱尋找索引定義。

public OdfSchemaIndex? FindIndex(string name)

Parameters

name string

The index name. / 索引名稱。

Returns

OdfSchemaIndex

The matching index, or null when it does not exist. / 符合的索引;不存在時為 null

RemoveColumn(string)

Removes a column definition by name. 依名稱移除欄位定義。

public bool RemoveColumn(string name)

Parameters

name string

The column name. / 欄位名稱。

Returns

bool

true if the column was removed; otherwise false. / 若已移除欄位則為 true;否則為 false

RemoveForeignKey(string)

Removes a named foreign key definition. 移除具名外鍵定義。

public bool RemoveForeignKey(string name)

Parameters

name string

The foreign key name. / 外鍵名稱。

Returns

bool

true if the foreign key was removed; otherwise false. / 若已移除外鍵則為 true;否則為 false

RemoveForeignKeyAt(int)

Removes a foreign key definition at the specified index, including unnamed definitions. 移除指定索引的外鍵定義,包括未具名的定義。

public void RemoveForeignKeyAt(int index)

Parameters

index int

The zero-based foreign key index. / 外鍵索引(從 0 起算)。

Exceptions

ArgumentOutOfRangeException

When index is outside the collection. / 當 index 超出集合範圍時擲出。

RemoveIndex(string)

Removes an index definition by name. 依名稱移除索引定義。

public bool RemoveIndex(string name)

Parameters

name string

The index name. / 索引名稱。

Returns

bool

true if the index was removed; otherwise false. / 若已移除索引則為 true;否則為 false

SetPrimaryKey(OdfSchemaPrimaryKey?)

Sets or clears the primary key definition. 設定或清除主鍵定義。

public void SetPrimaryKey(OdfSchemaPrimaryKey? primaryKey)

Parameters

primaryKey OdfSchemaPrimaryKey

The primary key definition, or null to clear it. / 主鍵定義;傳入 null 表示清除。