Share via


RuntimeModel.AddEntityType 方法

定義

多載

AddEntityType(String, Type, RuntimeEntityType, Boolean, String, ChangeTrackingStrategy, PropertyInfo, Boolean)

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

AddEntityType(String, Type, RuntimeEntityType, Boolean, String, ChangeTrackingStrategy, PropertyInfo, Boolean, Object)

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

AddEntityType(String, Type, RuntimeEntityType, Boolean, String, ChangeTrackingStrategy, PropertyInfo, Boolean)

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

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType AddEntityType (string name, Type type, Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType? baseType = default, bool sharedClrType = false, string? discriminatorProperty = default, Microsoft.EntityFrameworkCore.ChangeTrackingStrategy changeTrackingStrategy = Microsoft.EntityFrameworkCore.ChangeTrackingStrategy.Snapshot, System.Reflection.PropertyInfo? indexerPropertyInfo = default, bool propertyBag = false);
abstract member AddEntityType : string * Type * Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType * bool * string * Microsoft.EntityFrameworkCore.ChangeTrackingStrategy * System.Reflection.PropertyInfo * bool -> Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType
override this.AddEntityType : string * Type * Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType * bool * string * Microsoft.EntityFrameworkCore.ChangeTrackingStrategy * System.Reflection.PropertyInfo * bool -> Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType
Public Overridable Function AddEntityType (name As String, type As Type, Optional baseType As RuntimeEntityType = Nothing, Optional sharedClrType As Boolean = false, Optional discriminatorProperty As String = Nothing, Optional changeTrackingStrategy As ChangeTrackingStrategy = Microsoft.EntityFrameworkCore.ChangeTrackingStrategy.Snapshot, Optional indexerPropertyInfo As PropertyInfo = Nothing, Optional propertyBag As Boolean = false) As RuntimeEntityType

參數

name
String

要加入之實體類型的名稱。

type
Type

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

baseType
RuntimeEntityType

此實體類型的基底類型。

sharedClrType
Boolean

此實體類型是否可以與其他實體共用其 ClrType。

discriminatorProperty
String

將用於儲存鑒別子值的屬性名稱。

changeTrackingStrategy
ChangeTrackingStrategy

此實體類型的變更追蹤策略

indexerPropertyInfo
PropertyInfo

PropertyInfo如果存在,則為相關聯 CLR 型別上索引子的 。

propertyBag
Boolean

值,指出這個實體類型是否有索引子,其能夠包含任意屬性,以及可用來判斷指定索引子屬性是否包含值的方法。

傳回

新的實體類型。

適用於

AddEntityType(String, Type, RuntimeEntityType, Boolean, String, ChangeTrackingStrategy, PropertyInfo, Boolean, Object)

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

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType AddEntityType (string name, Type type, Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType? baseType = default, bool sharedClrType = false, string? discriminatorProperty = default, Microsoft.EntityFrameworkCore.ChangeTrackingStrategy changeTrackingStrategy = Microsoft.EntityFrameworkCore.ChangeTrackingStrategy.Snapshot, System.Reflection.PropertyInfo? indexerPropertyInfo = default, bool propertyBag = false, object? discriminatorValue = default);
abstract member AddEntityType : string * Type * Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType * bool * string * Microsoft.EntityFrameworkCore.ChangeTrackingStrategy * System.Reflection.PropertyInfo * bool * obj -> Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType
override this.AddEntityType : string * Type * Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType * bool * string * Microsoft.EntityFrameworkCore.ChangeTrackingStrategy * System.Reflection.PropertyInfo * bool * obj -> Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType
Public Overridable Function AddEntityType (name As String, type As Type, Optional baseType As RuntimeEntityType = Nothing, Optional sharedClrType As Boolean = false, Optional discriminatorProperty As String = Nothing, Optional changeTrackingStrategy As ChangeTrackingStrategy = Microsoft.EntityFrameworkCore.ChangeTrackingStrategy.Snapshot, Optional indexerPropertyInfo As PropertyInfo = Nothing, Optional propertyBag As Boolean = false, Optional discriminatorValue As Object = Nothing) As RuntimeEntityType

參數

name
String

要加入之實體類型的名稱。

type
Type

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

baseType
RuntimeEntityType

此實體類型的基底類型。

sharedClrType
Boolean

此實體類型是否可以與其他實體共用其 ClrType。

discriminatorProperty
String

將用於儲存鑒別子值的屬性名稱。

changeTrackingStrategy
ChangeTrackingStrategy

此實體類型的變更追蹤策略。

indexerPropertyInfo
PropertyInfo

PropertyInfo如果存在,則為相關聯 CLR 型別上索引子的 。

propertyBag
Boolean

值,指出這個實體類型是否有索引子,其能夠包含任意屬性,以及可用來判斷指定索引子屬性是否包含值的方法。

discriminatorValue
Object

這個實體類型的鑒別子值。

傳回

新的實體類型。

適用於