IMutableModel.AddEntityType 方法

定义

重载

AddEntityType(String)

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

AddEntityType(String, Type)

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

AddEntityType(Type)

将实体类型添加到模型。

AddEntityType(String, String, IMutableEntityType)

将具有定义导航的自有实体类型添加到模型。

AddEntityType(Type, String, IMutableEntityType)

将具有定义导航的自有实体类型添加到模型。

AddEntityType(String)

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

public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (string name);
abstract member AddEntityType : string -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
Public Function AddEntityType (name As String) As IMutableEntityType

参数

name
String

要添加的实体的名称。

返回

新的实体类型。

注解

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

适用于

AddEntityType(String, Type)

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

public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (string name, Type type);
abstract member AddEntityType : string * Type -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
Public Function AddEntityType (name As String, type As Type) As IMutableEntityType

参数

name
String

要添加的实体的名称。

type
Type

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

返回

新的实体类型。

注解

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

适用于

AddEntityType(Type)

将实体类型添加到模型。

public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (Type clrType);
public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (Type type);
abstract member AddEntityType : Type -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
abstract member AddEntityType : Type -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
Public Function AddEntityType (clrType As Type) As IMutableEntityType
Public Function AddEntityType (type As Type) As IMutableEntityType

参数

clrTypetype
Type

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

返回

新的实体类型。

适用于

AddEntityType(String, String, IMutableEntityType)

将具有定义导航的自有实体类型添加到模型。

public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (string name, string definingNavigationName, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType definingEntityType);
abstract member AddEntityType : string * string * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
Public Function AddEntityType (name As String, definingNavigationName As String, definingEntityType As IMutableEntityType) As IMutableEntityType

参数

name
String

要添加的实体类型的名称。

definingNavigationName
String

定义导航。

definingEntityType
IMutableEntityType

定义实体类型。

返回

新的实体类型。

适用于

AddEntityType(Type, String, IMutableEntityType)

将具有定义导航的自有实体类型添加到模型。

public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (Type clrType, string definingNavigationName, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType definingEntityType);
public Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType AddEntityType (Type type, string definingNavigationName, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType definingEntityType);
abstract member AddEntityType : Type * string * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
abstract member AddEntityType : Type * string * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType
Public Function AddEntityType (clrType As Type, definingNavigationName As String, definingEntityType As IMutableEntityType) As IMutableEntityType
Public Function AddEntityType (type As Type, definingNavigationName As String, definingEntityType As IMutableEntityType) As IMutableEntityType

参数

clrTypetype
Type

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

definingNavigationName
String

定义导航。

definingEntityType
IMutableEntityType

定义实体类型。

返回

新的实体类型。

适用于