RuntimeModel.AddEntityType Method

Definition

Overloads

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

Adds an entity type with a defining navigation to the model.

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

Adds an entity type with a defining navigation to the model.

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

Adds an entity type with a defining navigation to the model.

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

Parameters

name
String

The name of the entity type to be added.

type
Type

The CLR class that is used to represent instances of this type.

baseType
RuntimeEntityType

The base type of this entity type.

sharedClrType
Boolean

Whether this entity type can share its ClrType with other entities.

discriminatorProperty
String

The name of the property that will be used for storing a discriminator value.

changeTrackingStrategy
ChangeTrackingStrategy

The change tracking strategy for this entity type

indexerPropertyInfo
PropertyInfo

The PropertyInfo for the indexer on the associated CLR type if one exists.

propertyBag
Boolean

A value indicating whether this entity type has an indexer which is able to contain arbitrary properties and a method that can be used to determine whether a given indexer property contains a value.

Returns

The new entity type.

Applies to

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

Adds an entity type with a defining navigation to the model.

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

Parameters

name
String

The name of the entity type to be added.

type
Type

The CLR class that is used to represent instances of this type.

baseType
RuntimeEntityType

The base type of this entity type.

sharedClrType
Boolean

Whether this entity type can share its ClrType with other entities.

discriminatorProperty
String

The name of the property that will be used for storing a discriminator value.

changeTrackingStrategy
ChangeTrackingStrategy

The change tracking strategy for this entity type.

indexerPropertyInfo
PropertyInfo

The PropertyInfo for the indexer on the associated CLR type if one exists.

propertyBag
Boolean

A value indicating whether this entity type has an indexer which is able to contain arbitrary properties and a method that can be used to determine whether a given indexer property contains a value.

discriminatorValue
Object

The discriminator value for this entity type.

Returns

The new entity type.

Applies to