IConventionModel.AddEntityType 方法

定義

多載

AddEntityType(String, Boolean)

將預設類型的狀態實體類型新增至模型。

AddEntityType(String, Type, Boolean)

將共用類型實體類型新增至模型。

AddEntityType(Type, Boolean)

將實體類型加入模型。

AddEntityType(String, String, IConventionEntityType, Boolean)

將具有定義導覽的擁有實體類型新增至模型。

AddEntityType(Type, String, IConventionEntityType, Boolean)

將具有定義導覽的擁有實體類型新增至模型。

AddEntityType(String, Boolean)

將預設類型的狀態實體類型新增至模型。

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

參數

name
String

要加入的機構名稱。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

新的實體類型。

備註

在運行 DbContext 時間搭配 使用的模型中,目前不支援陰影實體。 因此,陰影狀態實體類型只會存在於移轉模型快照集等中。

適用於

AddEntityType(String, Type, Boolean)

將共用類型實體類型新增至模型。

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

參數

name
String

要加入的機構名稱。

clrType
Type

用來表示實體型別實例的 CLR 類別。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

新的實體類型。

備註

共用類型實體類型是實體類型,可以與模型中的其他類型共用 CLR 類型,但具有唯一的名稱,且一律由名稱識別。

適用於

AddEntityType(Type, Boolean)

將實體類型加入模型。

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

參數

clrTypetype
Type

用來表示實體型別實例的 CLR 類別。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

新的實體類型。

適用於

AddEntityType(String, String, IConventionEntityType, Boolean)

將具有定義導覽的擁有實體類型新增至模型。

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

參數

name
String

要加入的實體類型名稱。

definingNavigationName
String

定義導覽。

definingEntityType
IConventionEntityType

定義實體類型。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

新的實體類型。

適用於

AddEntityType(Type, String, IConventionEntityType, Boolean)

將具有定義導覽的擁有實體類型新增至模型。

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

參數

clrTypetype
Type

用來表示此實體類型的實例的 CLR 類別。

definingNavigationName
String

定義導覽。

definingEntityType
IConventionEntityType

定義實體類型。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

新的實體類型。

適用於