語言

IMutableForeignKey 介面

定義

代表一種關係,當依賴實體類型中的外金鑰屬性參考主實體類型中對應的主鍵或備用金鑰時。

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

備註

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

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

屬性

名稱 Description
DeclaringEntityType

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

DeleteBehavior

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

DependentToPrincipal

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

IsConstrained

設定一個值,表示關係是否受限,即有保證對每個外鍵值存在匹配主鍵。

IsOwnership

獲得或設定一個價值,指示此關係是否定義所有權。 若屬實,依賴實體必須始終透過主實體的導覽存取。

IsRequired

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

IsRequiredDependent

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

IsUnique

取得或設定一個值,指示外鍵屬性所指派的值是否唯一。

Item[String]

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

(繼承來源 IReadOnlyAnnotatable)
PrincipalEntityType

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

PrincipalKey

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

PrincipalToDependent

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

Properties

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

方法

名稱 Description
AddAnnotation(String, Object)

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

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

為物件添加註解。

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

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

(繼承來源 IAnnotatable)
AnnotationsToDebugString(Int32)

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

(繼承來源 IReadOnlyAnnotatable)
FindAnnotation(String)

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

(繼承來源 IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

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

(繼承來源 IAnnotatable)
FindRuntimeAnnotationValue(String)

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

(繼承來源 IAnnotatable)
GetAnnotation(String)

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

(繼承來源 IReadOnlyAnnotatable)
GetAnnotations()

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

(繼承來源 IReadOnlyAnnotatable)
GetDependentKeyValueFactory()

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

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

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

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

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

(繼承來源 IForeignKey)
GetNavigation(Boolean)

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

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

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

(繼承來源 IAnnotatable)
GetReferencingSkipNavigations()

所有跳過導航都用這個外鍵。

GetRelatedEntityType(IReadOnlyEntityType)

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

GetRuntimeAnnotations()

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

(繼承來源 IAnnotatable)
HasDependentToPrincipal(MemberInfo)
已淘汰.

將導航屬性設定在指向主要實體的依賴實體類型上。

HasDependentToPrincipal(PropertyInfo)

將導航屬性設定在指向主要實體的依賴實體類型上。

HasDependentToPrincipal(String)
已淘汰.

將導航屬性設定在指向主要實體的依賴實體類型上。

HasPrincipalToDependent(MemberInfo)
已淘汰.

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

HasPrincipalToDependent(PropertyInfo)

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

HasPrincipalToDependent(String)
已淘汰.

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

IsBaseLinking()

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

(繼承來源 IReadOnlyForeignKey)
IsEffectivelyRequired()

回傳一個值,表示該外鍵的集合值是否保證會參考現有的主體——也就是說,該關係同時是必要(IsRequired)且受約束(IsConstrained)。 查詢會參考此參數,以判斷依賴到主體的導覽是否可以用內部連接來擴展(以及此類連接是否可以被修剪);即使其外鍵屬性不可空,無約束關係仍被視為可選關係。

(繼承來源 IReadOnlyForeignKey)
RemoveAnnotation(String)

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

(繼承來源 IMutableAnnotatable)
RemoveRuntimeAnnotation(String)

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

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

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

(繼承來源 IMutableAnnotatable)
SetDependentToPrincipal(MemberInfo)

將導航屬性設定在指向主要實體的依賴實體類型上。

SetDependentToPrincipal(String)

將導航屬性設定在指向主要實體的依賴實體類型上。

SetOrRemoveAnnotation(String, Object)

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

(繼承來源 IMutableAnnotatable)
SetPrincipalToDependent(MemberInfo)

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

SetPrincipalToDependent(String)

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

SetProperties(IReadOnlyList<IMutableProperty>, IMutableKey)

設定外鍵屬性及目標主鍵。

SetRuntimeAnnotation(String, Object)

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

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

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

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

(繼承來源 IReadOnlyForeignKey)

擴充方法

名稱 Description
AddAnnotations(IMutableAnnotatable, IEnumerable<IAnnotation>)

為物件添加註解。

AnnotationsToDebugString(IAnnotatable, Int32)

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

FindSharedObjectRootForeignKey(IForeignKey, StoreObjectIdentifier)

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

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

FindSharedObjectRootForeignKey(IMutableForeignKey, StoreObjectIdentifier)

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

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

FindSharedObjectRootForeignKey(IReadOnlyForeignKey, StoreObjectIdentifier)

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

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

GetAnnotation(IAnnotatable, String)

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

GetAnnotation(IMutableAnnotatable, String)

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

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)

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

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

GetMappedConstraints(IForeignKey)

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

GetNavigation(IForeignKey, Boolean)

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

GetNavigation(IMutableForeignKey, Boolean)

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

GetOrAddAnnotation(IMutableAnnotatable, String, String)

取得帶有特定鍵的現有註解,或若不存在註解則新增。

GetRelatedEntityType(IForeignKey, IEntityType)

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

GetRelatedEntityType(IMutableForeignKey, IMutableEntityType)

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

IsBaseLinking(IForeignKey)

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

IsExcludedFromMigrations(IReadOnlyForeignKey)

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

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

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

Relational(IForeignKey)

取得外鍵的關聯式資料庫專屬元資料。

Relational(IMutableForeignKey)

取得外鍵的關聯式資料庫專屬元資料。

SetConstraintName(IMutableForeignKey, String)

設定外鍵約束名稱。

SetIsExcludedFromMigrations(IMutableForeignKey, Nullable<Boolean>)

設定一個值,表示外鍵限制是否被排除在遷移之外。

SetOrRemoveAnnotation(IMutableAnnotatable, String, Object)

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

Sqlite(IForeignKey)

取得外鍵的 SQLite 專屬元資料。

Sqlite(IMutableForeignKey)

取得外鍵的 SQLite 專屬元資料。

SqlServer(IForeignKey)

取得 SQL Server 專用的外鍵元資料。

SqlServer(IMutableForeignKey)

取得 SQL Server 專用的外鍵元資料。

ToDebugString(IForeignKey, MetadataDebugStringOptions, Int32)

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

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

適用於