ConventionEntityTypeExtensions.AddForeignKey(IConventionEntityType, IConventionProperty, IConventionKey, IConventionEntityType, Boolean) Yöntem

Tanım

Bu varlık türüne yeni bir ilişki ekler.

public static Microsoft.EntityFrameworkCore.Metadata.IConventionForeignKey AddForeignKey (this Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType entityType, Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, Microsoft.EntityFrameworkCore.Metadata.IConventionKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType principalEntityType, bool fromDataAnnotation = false);
static member AddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Microsoft.EntityFrameworkCore.Metadata.IConventionKey * Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionForeignKey
<Extension()>
Public Function AddForeignKey (entityType As IConventionEntityType, property As IConventionProperty, principalKey As IConventionKey, principalEntityType As IConventionEntityType, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKey

Parametreler

entityType
IConventionEntityType

Varlık türü.

property
IConventionProperty

Yabancı anahtarın tanımlandığı özellik.

principalKey
IConventionKey

Başvurulan birincil veya alternatif anahtar.

principalEntityType
IConventionEntityType

İlişkinin hedeflene varlık türü. Bu, ilişki bir devralma hiyerarşisinde türetilmiş bir türü hedeflese (anahtar hiyerarşinin temel türünde tanımlandığı için) üzerinde tanımlanan principalKey türden farklı olabilir.

fromDataAnnotation
Boolean

Yapılandırmanın veri ek açıklaması kullanılarak belirtilmemiş olup olmadığını gösterir.

Döndürülenler

IConventionForeignKey

Yeni oluşturulan yabancı anahtar.

Şunlara uygulanır