共用方式為


RuntimeEntityType.FindForeignKey 方法

定義

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

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeForeignKey? FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
abstract member FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.RuntimeForeignKey
override this.FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.RuntimeForeignKey
Public Overridable Function FindForeignKey (properties As IReadOnlyList(Of IReadOnlyProperty), principalKey As IReadOnlyKey, principalEntityType As IReadOnlyEntityType) As RuntimeForeignKey

參數

properties
IReadOnlyList<IReadOnlyProperty>

外鍵定義所在的屬性。

principalKey
IReadOnlyKey

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

principalEntityType
IReadOnlyEntityType

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

傳回

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

適用於