IConventionSkipNavigationBuilder.HasForeignKey 方法

定义

设置外键。

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionSkipNavigationBuilder HasForeignKey (Microsoft.EntityFrameworkCore.Metadata.IConventionForeignKey foreignKey, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionSkipNavigationBuilder? HasForeignKey (Microsoft.EntityFrameworkCore.Metadata.IConventionForeignKey? foreignKey, bool fromDataAnnotation = false);
abstract member HasForeignKey : Microsoft.EntityFrameworkCore.Metadata.IConventionForeignKey * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionSkipNavigationBuilder
Public Function HasForeignKey (foreignKey As IConventionForeignKey, Optional fromDataAnnotation As Boolean = false) As IConventionSkipNavigationBuilder

参数

foreignKey
IConventionForeignKey

外键。 null传递将导致没有关联的外键。

fromDataAnnotation
Boolean

指示配置是否是使用数据注释指定的。

返回

如果应用了配置,则为同一生成器实例, null 否则为 。

适用于