IMutableEntityType.AddForeignKey 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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
不同 (,因為索引鍵是在階層的基底類型上定義) 。
傳回
新建立的外鍵。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應