IMutableEntityType.AddForeignKey 方法

定義

多載

AddForeignKey(IMutableProperty, IMutableKey, IMutableEntityType)

將新的關聯性加入至這個實體類型。

AddForeignKey(IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType)

將新的關聯性加入至這個實體類型。

AddForeignKey(IMutableProperty, IMutableKey, IMutableEntityType)

將新的關聯性加入至這個實體類型。

public virtual Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey AddForeignKey (Microsoft.EntityFrameworkCore.Metadata.IMutableProperty property, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
abstract member AddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
override this.AddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
Public Overridable Function AddForeignKey (property As IMutableProperty, principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey

參數

property
IMutableProperty

外鍵定義所在的屬性。

principalKey
IMutableKey

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

principalEntityType
IMutableEntityType

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

傳回

新建立的外鍵。

適用於

AddForeignKey(IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType)

將新的關聯性加入至這個實體類型。

public Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey AddForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
abstract member AddForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
Public Function AddForeignKey (properties As IReadOnlyList(Of IMutableProperty), principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey

參數

properties
IReadOnlyList<IMutableProperty>

外鍵定義所在的屬性。

principalKey
IMutableKey

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

principalEntityType
IMutableEntityType

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

傳回

新建立的外鍵。

適用於