RuntimeForeignKey 類別

定義

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

public class RuntimeForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase, Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey
type RuntimeForeignKey = class
    inherit AnnotatableBase
    interface IRuntimeForeignKey
    interface IForeignKey
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
Public Class RuntimeForeignKey
Inherits AnnotatableBase
Implements IRuntimeForeignKey
繼承
RuntimeForeignKey
實作
IAnnotatable IReadOnlyAnnotatable IForeignKey Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey IReadOnlyForeignKey

備註

如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。

建構函式

RuntimeForeignKey(IReadOnlyList<RuntimeProperty>, RuntimeKey, RuntimeEntityType, RuntimeEntityType, DeleteBehavior, Boolean, Boolean, Boolean, Boolean)

這是支援 Entity Framework Core 基礎結構的內部 API,不受與公用 API 相同的相容性標準。 它可能會在任何版本中變更或移除,而不需任何通知。 您應該只在程式碼中直接使用它,並特別小心,並知道這麼做可能會導致應用程式在更新至新的 Entity Framework Core 版本時失敗。

屬性

DebugView

這是支援 Entity Framework Core 基礎結構的內部 API,不受與公用 API 相同的相容性標準。 它可能會在任何版本中變更或移除,而不需任何通知。 您應該只在程式碼中直接使用它,並特別小心,並知道這麼做可能會導致應用程式在更新至新的 Entity Framework Core 版本時失敗。

DeclaringEntityType

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

IsReadOnly

指出目前物件是否為唯讀。

(繼承來源 AnnotatableBase)
Item[String]

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

(繼承來源 AnnotatableBase)
PrincipalEntityType

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

PrincipalKey

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

Properties

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

ReferencingSkipNavigations

這是支援 Entity Framework Core 基礎結構的內部 API,不受與公用 API 相同的相容性標準。 它可能會在任何版本中變更或移除,而不會有任何通知。 您應該只在程式碼中直接使用它,並知道這麼做可能會導致應用程式在更新至新的 Entity Framework Core 版本時失敗。

方法

AddAnnotation(String, Annotation)

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

(繼承來源 AnnotatableBase)
AddAnnotation(String, Object)

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

(繼承來源 AnnotatableBase)
AddAnnotations(IEnumerable<IAnnotation>)

將批註加入至這個物件。

(繼承來源 AnnotatableBase)
AddAnnotations(IReadOnlyDictionary<String,Object>)

將批註加入至這個物件。

(繼承來源 AnnotatableBase)
AddNavigation(RuntimeNavigation, Boolean)

這是支援 Entity Framework Core 基礎結構的內部 API,不受與公用 API 相同的相容性標準。 它可能會在任何版本中變更或移除,而不需任何通知。 您應該只在程式碼中直接使用它,並特別小心,並知道這麼做可能會導致應用程式在更新至新的 Entity Framework Core 版本時失敗。

AddRuntimeAnnotation(String, Annotation)

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

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

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

(繼承來源 AnnotatableBase)
AddRuntimeAnnotations(IEnumerable<Annotation>)

將執行時間批註加入至這個物件。

(繼承來源 AnnotatableBase)
AddRuntimeAnnotations(IReadOnlyDictionary<String,Object>)

將執行時間批註加入至這個物件。

(繼承來源 AnnotatableBase)
CreateAnnotation(String, Object)

建立新的批註。

(繼承來源 AnnotatableBase)
CreateRuntimeAnnotation(String, Object)

建立新的執行時間批註。

(繼承來源 AnnotatableBase)
EnsureMutable()

如果模型是唯讀的,則會擲回 。

(繼承來源 AnnotatableBase)
EnsureReadOnly()

如果模型不是唯讀,則會擲回 。

(繼承來源 AnnotatableBase)
FindAnnotation(String)

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

(繼承來源 AnnotatableBase)
FindRuntimeAnnotation(String)

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

(繼承來源 AnnotatableBase)
GetAnnotation(String)

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

(繼承來源 AnnotatableBase)
GetAnnotations()

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

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

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

(繼承來源 AnnotatableBase)
GetRuntimeAnnotations()

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

(繼承來源 AnnotatableBase)
OnAnnotationSet(String, Annotation, Annotation)

設定或移除批註時呼叫。

(繼承來源 AnnotatableBase)
RemoveAnnotation(String)

從這個 物件中移除指定的注釋。

(繼承來源 AnnotatableBase)
RemoveRuntimeAnnotation(String)

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

(繼承來源 AnnotatableBase)
SetAnnotation(String, Annotation, Annotation)

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

(繼承來源 AnnotatableBase)
SetAnnotation(String, Object)

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

(繼承來源 AnnotatableBase)
SetRuntimeAnnotation(String, Annotation, Annotation)

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

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

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

(繼承來源 AnnotatableBase)
ToString()

傳回代表目前物件的字串。

明確介面實作

IAnnotatable.AddRuntimeAnnotation(String, Object)

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

(繼承來源 AnnotatableBase)
IAnnotatable.FindRuntimeAnnotation(String)

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

(繼承來源 AnnotatableBase)
IAnnotatable.GetRuntimeAnnotations()

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

(繼承來源 AnnotatableBase)
IAnnotatable.RemoveRuntimeAnnotation(String)

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

(繼承來源 AnnotatableBase)
IAnnotatable.SetRuntimeAnnotation(String, Object)

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

(繼承來源 AnnotatableBase)
IForeignKey.DeclaringEntityType

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

IForeignKey.DependentToPrincipal

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

IForeignKey.GetDependentKeyValueFactory()

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

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

IForeignKey.GetDependentKeyValueFactory<TKey>()

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

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

IForeignKey.PrincipalEntityType

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

IForeignKey.PrincipalKey

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

IForeignKey.PrincipalToDependent

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

IForeignKey.Properties

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

IReadOnlyAnnotatable.FindAnnotation(String)

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

(繼承來源 AnnotatableBase)
IReadOnlyAnnotatable.GetAnnotations()

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

(繼承來源 AnnotatableBase)
IReadOnlyAnnotatable.Item[String]

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

(繼承來源 AnnotatableBase)
IReadOnlyForeignKey.DeclaringEntityType

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

IReadOnlyForeignKey.DeleteBehavior

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

IReadOnlyForeignKey.DependentToPrincipal

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

IReadOnlyForeignKey.GetReferencingSkipNavigations()

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

IReadOnlyForeignKey.IsOwnership

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

IReadOnlyForeignKey.IsRequired

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

IReadOnlyForeignKey.IsRequiredDependent

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

IReadOnlyForeignKey.IsUnique

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

IReadOnlyForeignKey.PrincipalEntityType

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

IReadOnlyForeignKey.PrincipalKey

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

IReadOnlyForeignKey.PrincipalToDependent

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

IReadOnlyForeignKey.Properties

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

IRuntimeForeignKey.DependentKeyValueFactory

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

IRuntimeForeignKey.DependentsMapFactory

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

擴充方法

GetDependentKeyValueFactory<TKey>(IForeignKey)

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

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

GetNavigation(IForeignKey, Boolean)

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

GetRelatedEntityType(IForeignKey, IEntityType)

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

IsBaseLinking(IForeignKey)

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

ToDebugString(IForeignKey, MetadataDebugStringOptions, Int32)

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

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

AnnotationsToDebugString(IAnnotatable, Int32)

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

FindSharedObjectRootForeignKey(IForeignKey, StoreObjectIdentifier)

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

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

FindSharedObjectRootForeignKey(IReadOnlyForeignKey, StoreObjectIdentifier)

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

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

GetConstraintName(IForeignKey)

傳回外鍵條件約束名稱。

GetConstraintName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

傳回外鍵條件約束名稱。

GetConstraintName(IReadOnlyForeignKey)

傳回外鍵條件約束名稱。

GetConstraintName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

傳回外鍵條件約束名稱。

GetDefaultName(IForeignKey)

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

GetDefaultName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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

GetDefaultName(IReadOnlyForeignKey)

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

GetDefaultName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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

GetMappedConstraints(IForeignKey)

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

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

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

GetFluentApiCalls(IForeignKey, IAnnotationCodeGenerator, Boolean)

取得 Fluent API 呼叫以設定外鍵。

適用於