IConventionForeignKey 介面

定義

表示關聯性,其中相依實體類型中的外鍵屬性 () 參考主體實體類型中對應的主要或替代索引鍵。

public interface IConventionForeignKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IForeignKey
public interface IConventionForeignKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey
type IConventionForeignKey = interface
    interface IForeignKey
    interface IAnnotatable
    interface IConventionAnnotatable
type IConventionForeignKey = interface
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IConventionAnnotatable
Public Interface IConventionForeignKey
Implements IConventionAnnotatable, IForeignKey
Public Interface IConventionForeignKey
Implements IConventionAnnotatable, IReadOnlyForeignKey
實作

備註

此介面會在模型建立期間使用,並允許修改中繼資料。 建置模型之後, IForeignKey 表示相同中繼資料的唯讀檢視。

如需詳細資訊和範例,請參閱 模型建置慣例

屬性

Builder

取得可用來設定這個外鍵的產生器。

DeclaringEntityType

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

DeleteBehavior

取得值,指出刪除作業如何在刪除主體或中斷關聯性時,將刪除作業套用至關聯性中的相依實體。

(繼承來源 IReadOnlyForeignKey)
DependentToPrincipal

取得指向主體實體之相依實體類型的導覽屬性。

IsInModel

指出這個物件是否在模型中,亦即尚未從其中一個物件中移除。

(繼承來源 IConventionAnnotatable)
IsOwnership

取得值,指出這個關聯性是否定義擁有權。 如果 true 為 ,則一律必須透過主體實體的導覽來存取相依實體。

(繼承來源 IReadOnlyForeignKey)
IsRequired

取得值,指出是否需要主體實體。 如果 true 為 ,則相依實體必須一律指派給有效的主體實體。

(繼承來源 IReadOnlyForeignKey)
IsRequiredDependent

取得值,指出是否需要相依實體。 如果 true 為 ,則主體實體必須一律指派有效的相依實體。

(繼承來源 IReadOnlyForeignKey)
IsUnique

取得值,指出指派給外鍵屬性的值是否是唯一的。

(繼承來源 IReadOnlyForeignKey)
Item[String]

取得具有指定名稱之注釋的值,如果不存在,則傳 null 回 。

(繼承來源 IReadOnlyAnnotatable)
PrincipalEntityType

取得這個關聯性目標的主要實體類型。 這可能與當關聯性以繼承階層中的衍生型別為目標時所定義的類型 PrincipalKey 不同 (,因為索引鍵是在階層的基底類型上定義) 。

PrincipalKey

取得關聯性目標的主要或替代索引鍵。

PrincipalToDependent

取得指向相依實體之主體實體類型的導覽屬性。

Properties

取得相依實體中的外鍵屬性。

方法

AddAnnotation(String, Object, Boolean)

將注釋加入至這個物件。 如果具有指定名稱的注釋已經存在,則會擲回 。

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

將批註加入物件。

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

將執行時間批註新增至這個 物件。 如果具有指定名稱的注釋已經存在,則會擲回 。

(繼承來源 IAnnotatable)
AnnotationsToDebugString(Int32)

取得 物件上宣告之所有注釋的偵錯字串。

(繼承來源 IReadOnlyAnnotatable)
FindAnnotation(String)

取得具有指定名稱的注釋,如果不存在,則傳 null 回 。

(繼承來源 IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

取得具有指定名稱的執行時間批註,如果不存在,則 null 傳回 。

(繼承來源 IAnnotatable)
FindRuntimeAnnotationValue(String)

取得具有指定名稱的執行時間批註值,如果不存在,則傳 null 回 。

(繼承來源 IAnnotatable)
GetAnnotation(String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

(繼承來源 IReadOnlyAnnotatable)
GetAnnotations()

取得目前 物件上的所有批註。

(繼承來源 IReadOnlyAnnotatable)
GetConfigurationSource()

傳回此屬性的組態來源。

GetDeleteBehaviorConfigurationSource()

傳回 的 DeleteBehavior 組態來源。

GetDependentKeyValueFactory()

根據從各種實體資料形式取得的外鍵值,建立索引鍵值的處理站。

這個方法通常由資料庫提供者使用, (和其他延伸模組) 。 它通常不會用於應用程式程式碼中。

(繼承來源 IForeignKey)
GetDependentKeyValueFactory<TKey>()

根據從各種實體資料形式取得的外鍵值,建立索引鍵值的處理站。

這個方法通常由資料庫提供者 (和其他延伸模組) 使用。 它通常不會用於應用程式程式碼。

(繼承來源 IForeignKey)
GetDependentToPrincipalConfigurationSource()

傳回 的 DependentToPrincipal 組態來源。

GetIsOwnershipConfigurationSource()

傳回 的 IsOwnership 組態來源。

GetIsRequiredConfigurationSource()

傳回 的 IsRequired 組態來源。

GetIsRequiredDependentConfigurationSource()

傳回 的 IsRequiredDependent 組態來源。

GetIsUniqueConfigurationSource()

傳回 的 IsUnique 組態來源。

GetNavigation(Boolean)

傳回與此外鍵相關聯的導覽。

GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

取得具有指定名稱的執行時間批註值,如果不存在,請加以新增。

(繼承來源 IAnnotatable)
GetPrincipalEndConfigurationSource()

傳回 的 PrincipalEntityType 組態來源。

GetPrincipalKeyConfigurationSource()

傳回 的 PrincipalKey 組態來源。

GetPrincipalToDependentConfigurationSource()

傳回 的 PrincipalToDependent 組態來源。

GetPropertiesConfigurationSource()

傳回 的 Properties 組態來源。

GetReferencingSkipNavigations()

使用這個外鍵取得所有略過導覽。

GetRelatedEntityType(IReadOnlyEntityType)

取得與指定實體類型相關的實體類型。

GetRuntimeAnnotations()

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

(繼承來源 IAnnotatable)
HasDependentToPrincipal(MemberInfo, Boolean)
已過時。.

在指向主體實體的相依實體類型上設定導覽屬性。

HasDependentToPrincipal(String, Boolean)
已過時。.

在指向主體實體的相依實體類型上設定導覽屬性。

HasPrincipalToDependent(MemberInfo, Boolean)
已過時。.

在指向相依實體的主體實體類型上設定導覽屬性。

HasPrincipalToDependent(String, Boolean)
已過時。.

在指向相依實體的主體實體類型上設定導覽屬性。

IsBaseLinking()

傳回值,指出外鍵是否定義在主鍵上,並指向相同的主鍵。

(繼承來源 IReadOnlyForeignKey)
RemoveAnnotation(String)

從這個 物件中移除具有指定名稱的批註。

(繼承來源 IConventionAnnotatable)
RemoveRuntimeAnnotation(String)

從這個 物件中移除指定的執行時間批註。

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

設定儲存在指定名稱底下的批註。 如果具有指定名稱的注釋已經存在,則會覆寫現有的批註。

(繼承來源 IConventionAnnotatable)
SetDeleteBehavior(Nullable<DeleteBehavior>, Boolean)

設定值,指出刪除作業如何在刪除主體或中斷關聯性時,將刪除作業套用至關聯性中的相依實體。

SetDependentToPrincipal(MemberInfo, Boolean)

在指向主體實體的相依實體類型上設定導覽屬性。

SetDependentToPrincipal(String, Boolean)

在指向主體實體的相依實體類型上設定導覽屬性。

SetIsOwnership(Nullable<Boolean>, Boolean)

設定值,指出此關聯性是否定義擁有權。 如果 true 為 ,則一律必須透過主體實體的導覽來存取相依實體。

SetIsRequired(Nullable<Boolean>, Boolean)

設定值,指出是否需要主體實體。 如果 true 為 ,則相依實體必須一律指派給有效的主體實體。

SetIsRequiredDependent(Nullable<Boolean>, Boolean)

設定值,指出是否需要相依實體。 如果 true 為 ,則主體實體必須一律指派有效的相依實體。

SetIsUnique(Nullable<Boolean>, Boolean)

設定值,指出指派給外鍵屬性的值是否是唯一的。

SetOrRemoveAnnotation(String, Object, Boolean)

設定儲存在指定名稱底下的批註。 如果具有指定名稱的注釋已經存在,則會覆寫現有的批註。 如果 null 已提供,則會移除現有的批註。

(繼承來源 IConventionAnnotatable)
SetPrincipalToDependent(MemberInfo, Boolean)

在指向相依實體的主體實體類型上設定導覽屬性。

SetPrincipalToDependent(String, Boolean)

在指向相依實體的主體實體類型上設定導覽屬性。

SetProperties(IReadOnlyList<IConventionProperty>, IConventionKey, Boolean)

設定外鍵屬性,以及該目標主體索引鍵。

SetRuntimeAnnotation(String, Object)

設定儲存在指定索引鍵底下的執行時間批註。 如果具有指定名稱的注釋已經存在,則會覆寫現有的批註。

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

建立人類可讀取的指定中繼資料標記法。

警告:請勿依賴傳回字串的格式。 它是專為偵錯而設計,而且可能會在發行之間任意變更。

(繼承來源 IReadOnlyForeignKey)

擴充方法

AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

將批註加入物件。

GetAnnotation(IConventionAnnotatable, String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

設定儲存在指定名稱底下的批註。 如果具有指定名稱的注釋已經存在,則會覆寫現有的批註。 如果 null 已提供,則會移除現有的批註。

GetNavigation(IConventionForeignKey, Boolean)

傳回與此外鍵相關聯的導覽。

GetRelatedEntityType(IConventionForeignKey, IConventionEntityType)

取得與指定實體類型相關的實體類型。

GetDependentKeyValueFactory<TKey>(IForeignKey)

根據從各種實體資料形式取得的外鍵值,建立索引鍵值的處理站。

這個方法通常由資料庫提供者使用, (和其他延伸模組) 。 它通常不會用於應用程式程式碼中。

GetNavigation(IForeignKey, Boolean)

傳回與此外鍵相關聯的導覽。

GetRelatedEntityType(IForeignKey, IEntityType)

取得與指定實體類型相關的實體類型。

IsBaseLinking(IForeignKey)

傳回值,指出外鍵是否定義在主鍵上,並指向相同的主鍵。

ToDebugString(IForeignKey, MetadataDebugStringOptions, Int32)

建立人類可讀取的指定中繼資料標記法。

警告:不要依賴傳回字串的格式。 它專為偵錯而設計,而且可能會在發行之間任意變更。

AnnotationsToDebugString(IAnnotatable, Int32)

取得 物件上宣告之所有注釋的偵錯字串。

GetAnnotation(IAnnotatable, String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

FindSharedObjectRootForeignKey(IConventionForeignKey, StoreObjectIdentifier)

尋找對應至共用資料表類似物件中相同條件約束的第一 IConventionForeignKey 個 。

這個方法通常由資料庫提供者 (和其他延伸模組) 使用。 它通常不會用於應用程式程式碼。

FindSharedObjectRootForeignKey(IForeignKey, StoreObjectIdentifier)

尋找對應至共用資料表類似物件中相同條件約束的第一 IConventionForeignKey 個 。

這個方法通常由資料庫提供者 (和其他延伸模組) 使用。 它通常不會用於應用程式程式碼。

FindSharedObjectRootForeignKey(IReadOnlyForeignKey, StoreObjectIdentifier)

尋找對應至共用資料表類似物件中相同條件約束的第一 IForeignKey 個 。

這個方法通常由資料庫提供者 (和其他延伸模組) 使用。 它通常不會用於應用程式程式碼。

GetConstraintName(IForeignKey)

傳回外鍵條件約束名稱。

GetConstraintName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

傳回外鍵條件約束名稱。

GetConstraintName(IReadOnlyForeignKey)

傳回外鍵條件約束名稱。

GetConstraintName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

傳回外鍵條件約束名稱。

GetConstraintNameConfigurationSource(IConventionForeignKey)

ConfigurationSource取得條件約束名稱的 。

GetDefaultName(IForeignKey)

傳回將用於這個外鍵的預設條件約束名稱。

GetDefaultName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

傳回將用於這個外鍵的預設條件約束名稱。

GetDefaultName(IReadOnlyForeignKey)

傳回將用於這個外鍵的預設條件約束名稱。

GetDefaultName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

傳回將用於這個外鍵的預設條件約束名稱。

GetMappedConstraints(IForeignKey)

取得外鍵對應的外鍵條件約束。

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

傳回值,指出這個外鍵是否介於兩個共用相同類似資料表的存放區物件實體類型之間。

SetConstraintName(IConventionForeignKey, String, Boolean)

設定外鍵條件約束名稱。

適用於