共用方式為


RuntimeEntityType.IEntityType.FindForeignKey 方法

定義

取得指向指定主要或替代索引鍵之指定屬性的外鍵。 如果找不到外鍵,則傳 null 回 。

[System.Diagnostics.DebuggerStepThrough]
Microsoft.EntityFrameworkCore.Metadata.IForeignKey? IEntityType.FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
[System.Diagnostics.DebuggerStepThrough]
Microsoft.EntityFrameworkCore.Metadata.IForeignKey IEntityType.FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
[<System.Diagnostics.DebuggerStepThrough>]
abstract member Microsoft.EntityFrameworkCore.Metadata.IEntityType.FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IForeignKey
override this.Microsoft.EntityFrameworkCore.Metadata.IEntityType.FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IForeignKey
Function FindForeignKey (properties As IReadOnlyList(Of IReadOnlyProperty), principalKey As IReadOnlyKey, principalEntityType As IReadOnlyEntityType) As IForeignKey Implements IEntityType.FindForeignKey

參數

properties
IReadOnlyList<IReadOnlyProperty>

外鍵定義所在的屬性。

principalKey
IReadOnlyKey

參考的主要或替代索引鍵。

principalEntityType
IReadOnlyEntityType

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

傳回

外鍵,如果沒有定義,則 null 為 。

實作

屬性

適用於