IConventionModel.AddOwnedEntityType 方法

定义

重载

AddOwnedEntityType(String, Type, Boolean)

将拥有的共享类型实体类型添加到模型。

AddOwnedEntityType(Type, Boolean)

将拥有的实体类型添加到模型。

AddOwnedEntityType(String, Boolean)

将默认类型的自有实体类型添加到模型。

AddOwnedEntityType(String, Type, Boolean)

将拥有的共享类型实体类型添加到模型。

public Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType? AddOwnedEntityType (string name, Type clrType, bool fromDataAnnotation = false);
abstract member AddOwnedEntityType : string * Type * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType
Public Function AddOwnedEntityType (name As String, clrType As Type, Optional fromDataAnnotation As Boolean = false) As IConventionEntityType

参数

name
String

要添加的实体的名称。

clrType
Type

用于表示实体类型的实例的 CLR 类。

fromDataAnnotation
Boolean

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

返回

新的实体类型。

注解

共享类型实体类型是一种实体类型,它可以与模型中的其他类型的 CLR 类型共享,但具有唯一的名称,并且始终由名称标识。

适用于

AddOwnedEntityType(Type, Boolean)

将拥有的实体类型添加到模型。

public Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType? AddOwnedEntityType (Type type, bool fromDataAnnotation = false);
abstract member AddOwnedEntityType : Type * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType
Public Function AddOwnedEntityType (type As Type, Optional fromDataAnnotation As Boolean = false) As IConventionEntityType

参数

type
Type

用于表示实体类型的实例的 CLR 类。

fromDataAnnotation
Boolean

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

返回

新的实体类型。

适用于

AddOwnedEntityType(String, Boolean)

将默认类型的自有实体类型添加到模型。

public Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType? AddOwnedEntityType (string name, bool fromDataAnnotation = false);
abstract member AddOwnedEntityType : string * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType
Public Function AddOwnedEntityType (name As String, Optional fromDataAnnotation As Boolean = false) As IConventionEntityType

参数

name
String

要添加的实体的名称。

fromDataAnnotation
Boolean

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

返回

新的实体类型。

注解

在运行时与 DbContext一起使用的模型中,阴影实体当前不受支持。 因此,影子状态实体类型将仅存在于迁移模型快照等中。

适用于