MutableEntityTypeExtensions.GetOrAddForeignKey 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
GetOrAddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType) |
取得現有的關聯性,如果尚未定義,則建立新的關聯性。 |
GetOrAddForeignKey(IMutableEntityType, IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType) |
取得現有的關聯性,如果尚未定義,則建立新的關聯性。 |
GetOrAddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType)
取得現有的關聯性,如果尚未定義,則建立新的關聯性。
public static Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey GetOrAddForeignKey (this Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType entityType, Microsoft.EntityFrameworkCore.Metadata.IMutableProperty property, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
static member GetOrAddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType * Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
<Extension()>
Public Function GetOrAddForeignKey (entityType As IMutableEntityType, property As IMutableProperty, principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey
參數
- entityType
- IMutableEntityType
要取得或新增外鍵的實體類型。
- property
- IMutableProperty
外鍵定義所在的屬性。
- principalKey
- IMutableKey
參考的主要或替代索引鍵。
- principalEntityType
- IMutableEntityType
關聯性針對的實體型別。 這可能與關聯性以繼承階層中的衍生類型為目標時所定義的類型 principalKey
不同 (,因為索引鍵是在階層的基底類型上定義) 。
傳回
現有或新建立的外鍵。
適用於
GetOrAddForeignKey(IMutableEntityType, IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType)
取得現有的關聯性,如果尚未定義,則建立新的關聯性。
public static Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey GetOrAddForeignKey (this Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType entityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
static member GetOrAddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
<Extension()>
Public Function GetOrAddForeignKey (entityType As IMutableEntityType, properties As IReadOnlyList(Of IMutableProperty), principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey
參數
- entityType
- IMutableEntityType
要取得或新增外鍵的實體類型。
- properties
- IReadOnlyList<IMutableProperty>
外鍵定義所在的屬性。
- principalKey
- IMutableKey
參考的主要或替代索引鍵。
- principalEntityType
- IMutableEntityType
關聯性針對的實體型別。 這可能與關聯性以繼承階層中的衍生類型為目標時所定義的類型 principalKey
不同 (,因為索引鍵是在階層的基底類型上定義) 。
傳回
現有或新建立的外鍵。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應