語言

IConventionKey 介面

定義

代表實體上的主鍵或備用鍵。

public interface IConventionKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey
public interface IConventionKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IKey
type IConventionKey = interface
    interface IReadOnlyKey
    interface IReadOnlyAnnotatable
    interface IConventionAnnotatable
type IConventionKey = interface
    interface IConventionAnnotatable
    interface IAnnotatable
    interface IKey
Public Interface IConventionKey
Implements IConventionAnnotatable, IReadOnlyKey
Public Interface IConventionKey
Implements IConventionAnnotatable, IKey
實作

備註

此介面用於模型建立時,允許修改元資料。 模型建構完成後,代表 IKey 同一元資料的唯讀視圖。

更多資訊與範例請參閱 模型建構慣例 。

屬性

名稱 Description
Builder

取得可以用來設定此金鑰的建構器。

DeclaringEntityType

取得金鑰所定義的實體類型。 這可能與定義在繼承階層中的衍生型別時所定義的型別 Properties 不同(因為屬性可能定義在基底型態上)。

IsInModel

表示該物件是否在模型中,也就是尚未從模型中移除。

(繼承來源 IConventionAnnotatable)
Item[String]

取得帶有名稱的值註解,若不存在則回 null 傳。

(繼承來源 IAnnotatable)
Properties

取得構成金鑰的屬性。

方法

名稱 Description
AddAnnotation(String, Object, Boolean)

為此物件新增註解。 如果已有指定名稱的註解存在,則會拋出。

(繼承來源 IConventionAnnotatable)
AddAnnotations(IEnumerable<IConventionAnnotation>, Boolean)

為物件添加註解。

(繼承來源 IConventionAnnotatable)
AddRuntimeAnnotation(String, Object)

為此物件新增執行時註解。 如果已有指定名稱的註解存在,則會拋出。

(繼承來源 IAnnotatable)
AnnotationsToDebugString(Int32)

取得物件上所有宣告註解的除錯字串。

(繼承來源 IReadOnlyAnnotatable)
FindAnnotation(String)

取得帶有名字的註解,若不存在則回 null 傳。

(繼承來源 IAnnotatable)
FindRuntimeAnnotation(String)

取得帶有名稱的執行時註解,若不存在則回 null 傳。

(繼承來源 IAnnotatable)
FindRuntimeAnnotationValue(String)

取得執行時註解的值,若名稱不存在則回 null 傳。

(繼承來源 IAnnotatable)
GetAnnotation(String)

取得帶有名稱的註解,若不存在則拋出。

(繼承來源 IConventionAnnotatable)
GetAnnotations()

取得目前物件的所有註解。

(繼承來源 IAnnotatable)
GetConfigurationSource()

回傳此金鑰的設定來源。

GetKeyType()

對於簡單鍵,會回傳金鑰屬性的型別,對於複合金鑰則會回傳物件陣列的型別。

(繼承來源 IKey)
GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

取得帶有名稱的執行時註解值,若不存在則加入該註解。

(繼承來源 IAnnotatable)
GetPrincipalKeyValueFactory()

根據從各種實體資料中取得的鍵值,建立一個工廠來儲存關鍵值。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

(繼承來源 IKey)
GetPrincipalKeyValueFactory<TKey>()

根據從各種實體資料中取得的鍵值,建立一個工廠來儲存關鍵值。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

(繼承來源 IKey)
GetReferencingForeignKeys()

取得所有針對特定主鍵或備用鍵的外鍵。

GetRuntimeAnnotations()

取得目前物件上的所有執行時註解。

(繼承來源 IAnnotatable)
IsPrimaryKey()

回傳一個值,表示該鍵是否為主鍵。

(繼承來源 IReadOnlyKey)
RemoveAnnotation(String)

移除這個物件中帶有名字的註解。

(繼承來源 IConventionAnnotatable)
RemoveRuntimeAnnotation(String)

移除該物件中給定的執行時註解。

(繼承來源 IAnnotatable)
SetAnnotation(String, Object, Boolean)

設定以名字儲存的註解。 若已有指定名稱的註解存在,則會覆寫現有註解。

(繼承來源 IConventionAnnotatable)
SetOrRemoveAnnotation(String, Object, Boolean)

設定以名字儲存的註解。 若已有指定名稱的註解存在,則會覆寫現有註解。 若 null 提供 則移除現有註解。

(繼承來源 IConventionAnnotatable)
SetRuntimeAnnotation(String, Object)

設定在指定鍵值下儲存的執行時註解。 若已有指定名稱的註解存在,則會覆寫現有註解。

(繼承來源 IAnnotatable)
ToDebugString(MetadataDebugStringOptions, Int32)

建立給定元資料的可讀表示法。

警告:請勿依賴回傳字串的格式。 它僅設計用於除錯,且可能在不同版本間任意變動。

(繼承來源 IReadOnlyKey)

擴充方法

名稱 Description
AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

為物件添加註解。

AnnotationsToDebugString(IAnnotatable, Int32)

取得物件上所有宣告註解的除錯字串。

FindSharedObjectRootKey(IConventionKey, StoreObjectIdentifier)

找到第一個 IConventionKey 映射到相同限制的共享資料表類物件。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

FindSharedObjectRootKey(IKey, StoreObjectIdentifier)

找到第一個 IConventionKey 映射到相同限制的共享資料表類物件。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

FindSharedObjectRootKey(IReadOnlyKey, StoreObjectIdentifier)

找到第一個 IKey 映射到相同限制的共享資料表類物件。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

GetAnnotation(IAnnotatable, String)

取得帶有名稱的註解,若不存在則拋出。

GetAnnotation(IConventionAnnotatable, String)

取得帶有名稱的註解,若不存在則拋出。

GetDefaultName(IKey, StoreObjectIdentifier)

回傳該鍵在特定資料表中所使用的預設鍵限制名稱。

GetDefaultName(IKey)

回傳該鍵所用的預設鍵約束名稱。

GetDefaultName(IReadOnlyKey, StoreObjectIdentifier)

回傳該鍵在特定資料表中所使用的預設鍵限制名稱。

GetDefaultName(IReadOnlyKey)

回傳該鍵所用的預設鍵約束名稱。

GetFillFactor(IReadOnlyKey, StoreObjectIdentifier)

回傳金鑰所使用的填充因子。

GetFillFactor(IReadOnlyKey)

回傳金鑰所使用的填充因子。

GetFillFactorConfigurationSource(IConventionKey)

回傳 , ConfigurationSource 對於金鑰是否使用填充因子。

GetIsClusteredConfigurationSource(IConventionKey)

取得 ConfigurationSource for 鍵值是否為叢集。

GetKeyType(IKey)

對於簡單鍵,會回傳金鑰屬性的型別,對於複合金鑰則會回傳物件陣列的型別。

GetMappedConstraints(IKey)

取得該金鑰所映射的唯一限制條件。

GetName(IKey, StoreObjectIdentifier)

回傳該鍵對特定資料表的鍵約束名稱。

GetName(IKey)

回傳該鍵的鍵約束名稱。

GetName(IReadOnlyKey, StoreObjectIdentifier)

回傳該鍵對特定資料表的鍵約束名稱。

GetName(IReadOnlyKey)

回傳該鍵的鍵約束名稱。

GetNameConfigurationSource(IConventionKey)

會取得約束名稱的 。ConfigurationSource

GetPrincipalKeyValueFactory<TKey>(IKey)

根據從各種實體資料取得的索引鍵值,獲得一個關鍵值的工廠。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

GetReferencingForeignKeys(IConventionKey)

取得所有針對特定主鍵或備用鍵的外鍵。

GetReferencingForeignKeys(IKey)

取得所有針對特定主鍵或備用鍵的外鍵。

IsClustered(IKey, StoreObjectIdentifier)

回傳一個值,表示該金鑰是否為叢集。

IsClustered(IKey)

回傳一個值,表示該金鑰是否為叢集。

IsClustered(IReadOnlyKey, StoreObjectIdentifier)

回傳一個值,表示該金鑰是否為叢集。

IsClustered(IReadOnlyKey)

回傳一個值,表示該金鑰是否為叢集。

IsPrimaryKey(IKey)

回傳一個值,表示該鍵是否為主鍵。

SetFillFactor(IConventionKey, Nullable<Int32>, Boolean)

設定金鑰所用的填充因子值。

SetIsClustered(IConventionKey, Nullable<Boolean>, Boolean)

設定一個值,表示該鍵是否為叢集。

SetName(IConventionKey, String, Boolean)

設定此鍵的鍵約束名稱。

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

設定以名字儲存的註解。 若已有指定名稱的註解存在,則會覆寫現有註解。 若 null 提供 則移除現有註解。

ToDebugString(IKey, MetadataDebugStringOptions, Int32)

建立給定元資料的可讀表示法。

警告:請勿依賴回傳字串的格式。 它僅設計用於除錯,且可能在不同版本間任意變動。

適用於