Class OdfSchemaTable
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
namestringThe table name. / 資料表名稱。
Exceptions
- ArgumentException
When
nameis empty. / 當name為空時擲出。
Properties
Columns
Gets the list of table columns. 取得資料表欄位清單。
public IReadOnlyList<OdfSchemaColumn> Columns { get; }
Property Value
ForeignKeys
Gets the list of foreign key relationship definitions of the table. 取得資料表的外鍵關聯定義清單。
public IReadOnlyList<OdfSchemaForeignKey> ForeignKeys { get; }
Property Value
Indexes
Gets the list of index definitions of the table. 取得資料表的索引定義清單。
public IReadOnlyList<OdfSchemaIndex> Indexes { get; }
Property Value
Name
Gets the table name. 取得資料表名稱。
public string Name { get; }
Property Value
PrimaryKey
Gets the primary key definition of the table. 取得資料表的主鍵定義。
public OdfSchemaPrimaryKey? PrimaryKey { get; }
Property Value
Methods
AddColumn(OdfSchemaColumn)
Adds a column definition. 新增欄位定義。
public void AddColumn(OdfSchemaColumn column)
Parameters
columnOdfSchemaColumnThe column definition. / 欄位定義。
Exceptions
- ArgumentNullException
- InvalidOperationException
When a column with the same name already exists. / 當同名欄位已存在時擲出。
AddForeignKey(OdfSchemaForeignKey)
Adds a foreign key definition. 新增外鍵定義。
public void AddForeignKey(OdfSchemaForeignKey foreignKey)
Parameters
foreignKeyOdfSchemaForeignKeyThe foreign key definition. / 外鍵定義。
Exceptions
- ArgumentNullException
- InvalidOperationException
When a named foreign key with the same name already exists. / 當同名具名外鍵已存在時擲出。
AddIndex(OdfSchemaIndex)
Adds an index definition. 新增索引定義。
public void AddIndex(OdfSchemaIndex index)
Parameters
indexOdfSchemaIndexThe index definition. / 索引定義。
Exceptions
- ArgumentNullException
- InvalidOperationException
When an index with the same name already exists. / 當同名索引已存在時擲出。
FindColumn(string)
Finds a column definition by name. 依名稱尋找欄位定義。
public OdfSchemaColumn? FindColumn(string name)
Parameters
namestringThe column name. / 欄位名稱。
Returns
- OdfSchemaColumn
The matching column, or null when it does not exist. / 符合的欄位;不存在時為 null。
Exceptions
- ArgumentException
When
nameis blank. / 當name為空白時擲出。
FindIndex(string)
Finds an index definition by name. 依名稱尋找索引定義。
public OdfSchemaIndex? FindIndex(string name)
Parameters
namestringThe 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
namestringThe column name. / 欄位名稱。
Returns
RemoveForeignKey(string)
Removes a named foreign key definition. 移除具名外鍵定義。
public bool RemoveForeignKey(string name)
Parameters
namestringThe foreign key name. / 外鍵名稱。
Returns
RemoveForeignKeyAt(int)
Removes a foreign key definition at the specified index, including unnamed definitions. 移除指定索引的外鍵定義,包括未具名的定義。
public void RemoveForeignKeyAt(int index)
Parameters
indexintThe zero-based foreign key index. / 外鍵索引(從 0 起算)。
Exceptions
- ArgumentOutOfRangeException
When
indexis outside the collection. / 當index超出集合範圍時擲出。
RemoveIndex(string)
Removes an index definition by name. 依名稱移除索引定義。
public bool RemoveIndex(string name)
Parameters
namestringThe index name. / 索引名稱。
Returns
SetPrimaryKey(OdfSchemaPrimaryKey?)
Sets or clears the primary key definition. 設定或清除主鍵定義。
public void SetPrimaryKey(OdfSchemaPrimaryKey? primaryKey)
Parameters
primaryKeyOdfSchemaPrimaryKeyThe primary key definition, or null to clear it. / 主鍵定義;傳入 null 表示清除。