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 ,因为键是在层次结构) 基类型上定义的。

返回

新建的外键。

适用于