語言

RuntimeForeignKey 類別

定義

代表一種關係,由依賴實體類型上的屬性組成的外鍵,參考主實體類型中對應的主鍵或備用鍵。

[System.Runtime.CompilerServices.Nullable(0)]
public class RuntimeForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.RuntimeAnnotatableBase, Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey
public class RuntimeForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase, Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey
[System.Runtime.CompilerServices.Nullable(0)]
public class RuntimeForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase, Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey
[<System.Runtime.CompilerServices.Nullable(0)>]
type RuntimeForeignKey = class
    inherit RuntimeAnnotatableBase
    interface IRuntimeForeignKey
    interface IForeignKey
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
type RuntimeForeignKey = class
    inherit AnnotatableBase
    interface IRuntimeForeignKey
    interface IForeignKey
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
[<System.Runtime.CompilerServices.Nullable(0)>]
type RuntimeForeignKey = class
    inherit AnnotatableBase
    interface IRuntimeForeignKey
    interface IForeignKey
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
Public Class RuntimeForeignKey
Inherits RuntimeAnnotatableBase
Implements IRuntimeForeignKey
Public Class RuntimeForeignKey
Inherits AnnotatableBase
Implements IRuntimeForeignKey
繼承
RuntimeForeignKey
繼承
RuntimeForeignKey
屬性
實作
IAnnotatable IReadOnlyAnnotatable IForeignKey Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey IReadOnlyForeignKey

備註

更多資訊與範例請參閱 建模實體類型與關係 。

建構函式

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

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

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

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

屬性

名稱 Description
DebugView

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

DeclaringEntityType

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

IsReadOnly

表示目前物件是否為唯讀。

(繼承來源 AnnotatableBase)
Item[String]

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

(繼承來源 RuntimeAnnotatableBase)
Item[String]

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

(繼承來源 AnnotatableBase)
PrincipalEntityType

取得此關係所針對的主要實體類型。 這可能與當關係針對繼承階層中的衍生型別時所定義的型 PrincipalKey 別不同(因為金鑰定義在階層的基底型態上)。

PrincipalKey

他會得到這段關係的主要或替代關鍵。

Properties

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

ReferencingSkipNavigations

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

方法

名稱 Description
AddAnnotation(String, Annotation)

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

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

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

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

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

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

為此物件新增註解,覆蓋任何同名的現有註解。

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

為此物件新增註解。

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

為此物件新增註解,覆蓋任何同名的現有註解。

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

為此物件新增註解。

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

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

AddRuntimeAnnotation(String, Annotation)

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

(繼承來源 RuntimeAnnotatableBase)
AddRuntimeAnnotation(String, Annotation)

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

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

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

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

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

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

為此物件新增執行時註解。

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

為此物件新增執行時註解。

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

為此物件新增執行時註解。

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

為此物件新增執行時註解。

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

建立新的註解。

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

建立新的註解。

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

建立新的執行時註解。

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

建立新的執行時註解。

(繼承來源 AnnotatableBase)
EnsureMutable()

如果模型是唯讀,則會拋出。

(繼承來源 AnnotatableBase)
EnsureReadOnly()

若模型非唯讀,則會擲出。

(繼承來源 AnnotatableBase)
FindAnnotation(String)

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

(繼承來源 RuntimeAnnotatableBase)
FindAnnotation(String)

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

(繼承來源 AnnotatableBase)
FindRuntimeAnnotation(String)

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

(繼承來源 RuntimeAnnotatableBase)
FindRuntimeAnnotation(String)

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

(繼承來源 AnnotatableBase)
GetAnnotation(String)

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

(繼承來源 RuntimeAnnotatableBase)
GetAnnotation(String)

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

(繼承來源 AnnotatableBase)
GetAnnotations()

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

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

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

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

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

(繼承來源 AnnotatableBase)
GetRuntimeAnnotations()

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

(繼承來源 RuntimeAnnotatableBase)
GetRuntimeAnnotations()

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

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

當註解被設定或移除時會被呼叫。

(繼承來源 AnnotatableBase)
RemoveAnnotation(String)

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

(繼承來源 RuntimeAnnotatableBase)
RemoveAnnotation(String)

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

(繼承來源 AnnotatableBase)
RemoveRuntimeAnnotation(String)

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

(繼承來源 RuntimeAnnotatableBase)
RemoveRuntimeAnnotation(String)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(繼承來源 AnnotatableBase)
ToString()

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

明確介面實作

名稱 Description
IAnnotatable.AddRuntimeAnnotation(String, Object)

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

(繼承來源 RuntimeAnnotatableBase)
IAnnotatable.AddRuntimeAnnotation(String, Object)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(繼承來源 RuntimeAnnotatableBase)
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 傳。

(繼承來源 RuntimeAnnotatableBase)
IReadOnlyAnnotatable.FindAnnotation(String)

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

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

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

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

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

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

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

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

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

(繼承來源 AnnotatableBase)
IReadOnlyForeignKey.DeclaringEntityType

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

IReadOnlyForeignKey.DeleteBehavior

會取得一個值,表示當主體被刪除或關係被切斷時,如何對關聯中的相依實體套用刪除操作。

IReadOnlyForeignKey.DependentToPrincipal

取得指向主要實體的依賴實體類型上的導航屬性。

IReadOnlyForeignKey.GetReferencingSkipNavigations()

用這個外鍵來抓到跳過導航。

IReadOnlyForeignKey.IsConstrained

獲得一個值,表示該關係是否受約束,即有保證(例如資料庫外鍵約束)支持,確保每個外鍵值都存在匹配的主鍵。 當 false時,不會建立資料庫外鍵限制,查詢仍將該關係視為可選,即使外鍵屬性不可空——主鍵會被載入左連接,且不會假定其存在。 這不影響變更追蹤:必要的(IsRequired)關係在被切斷時仍會連鎖反應或產生概念空值,不論該值為何。

IReadOnlyForeignKey.IsOwnership

會有一個值,表示此關係是否定義了所有權。 若 true,則必須始終透過主實體的導覽存取該受依賴實體。

IReadOnlyForeignKey.IsRequired

會獲得一個值,表示是否需要主要實體。 若 true,則依賴實體必須始終指派給有效的主要實體。

IReadOnlyForeignKey.IsRequiredDependent

會得到一個值,表示是否需要依賴實體。 若 true,主實體必須始終指派有效的依屬實體。

IReadOnlyForeignKey.IsUnique

會得到一個值,表示外鍵屬性所指派的值是否唯一。

IReadOnlyForeignKey.PrincipalEntityType

取得此關係所針對的主要實體類型。 這可能與當關係針對繼承階層中的衍生型別時所定義的型 PrincipalKey 別不同(因為金鑰定義在階層的基底型態上)。

IReadOnlyForeignKey.PrincipalKey

他會得到這段關係的主要或替代關鍵。

IReadOnlyForeignKey.PrincipalToDependent

取得指向依賴實體的主實體類型上的導航屬性。

IReadOnlyForeignKey.Properties

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

IRuntimeForeignKey.DependentKeyValueFactory

代表一種關係,由依賴實體類型上的屬性組成的外鍵,參考主實體類型中對應的主鍵或備用鍵。

IRuntimeForeignKey.DependentsMapFactory

代表一種關係,由依賴實體類型上的屬性組成的外鍵,參考主實體類型中對應的主鍵或備用鍵。

擴充方法

名稱 Description
AnnotationsToDebugString(IAnnotatable, Int32)

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

FindSharedObjectRootForeignKey(IForeignKey, StoreObjectIdentifier)

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

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

FindSharedObjectRootForeignKey(IReadOnlyForeignKey, StoreObjectIdentifier)

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

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

GetConstraintName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

回傳外鍵約束名稱。

GetConstraintName(IForeignKey)

回傳外鍵約束名稱。

GetConstraintName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

回傳外鍵約束名稱。

GetConstraintName(IReadOnlyForeignKey)

回傳外鍵約束名稱。

GetDefaultName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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

GetDefaultName(IForeignKey)

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

GetDefaultName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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

GetDefaultName(IReadOnlyForeignKey)

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

GetDependentKeyValueFactory<TKey>(IForeignKey)

根據從各種實體資料取得的外鍵值,建立一個金鑰工廠。

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

GetFluentApiCalls(IForeignKey, IAnnotationCodeGenerator, Boolean)

能取得流暢的 API 呼叫來配置外鍵。

GetMappedConstraints(IForeignKey)

取得外鍵所映射的外鍵約束條件。

GetNavigation(IForeignKey, Boolean)

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

GetRelatedEntityType(IForeignKey, IEntityType)

取得與該實體相關的實體類型。

IsBaseLinking(IForeignKey)

回傳一個值,表示外鍵是否定義在主鍵上,且指向同一主鍵。

IsExcludedFromMigrations(IReadOnlyForeignKey)

回傳一個值,表示外鍵約束是否被排除在遷移之外。

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

回傳一個值,表示此外鍵是否存在於兩個共用相同資料表類儲存物件的實體類型之間。

ToDebugString(IForeignKey, MetadataDebugStringOptions, Int32)

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

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

適用於