IMutableModel IMutableModel Interface

Definition

Metadata about the shape of entities, the relationships between them, and how they map to the database. A model is typically created by overriding the OnConfiguring(DbContextOptionsBuilder) method on a derived context, or using ModelBuilder.

This interface is used during model creation and allows the metadata to be modified. Once the model is built, IModel represents a ready-only view of the same metadata.

public interface IMutableModel : IModel, IMutableAnnotatable, IAnnotatable
Public Interface IMutableModel
    Inherits IModel, IMutableAnnotatable

Inherited Members

Microsoft.EntityFrameworkCore.Metadata.IMutableAnnotatable

Item[System.String]Item(System.String)
AddAnnotation(System.String, System.Object)AddAnnotation(System.String, System.Object)
FindAnnotation(System.String)FindAnnotation(System.String)
RemoveAnnotation(System.String)RemoveAnnotation(System.String)

Methods

AddEntityType(String) AddEntityType(String)

Adds a shadow state entity type to the model.

Shadow entities are not currently supported in a model that is used at runtime with a DbContext. Therefore, shadow state entity types will only exist in migration model snapshots, etc.

IMutableEntityType AddEntityType(string name)
Function AddEntityType(name As String) As IMutableEntityType
Parameters
name
System.String System.String

The name of the entity to be added.

Returns

The new entity type.

AddEntityType(Type) AddEntityType(Type)

Adds an entity type to the model.

IMutableEntityType AddEntityType(Type clrType)
Function AddEntityType(clrType As Type) As IMutableEntityType
Parameters
clrType
System.Type System.Type

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

Returns

The new entity type.

FindEntityType(String) FindEntityType(String)

Gets the entity with the given name. Returns null if no entity type with the given name is found.

IMutableEntityType FindEntityType(string name)
Function FindEntityType(name As String) As IMutableEntityType
Parameters
name
System.String System.String

The name of the entity type to find.

Returns

The entity type, or null if none are found.

GetEntityTypes() GetEntityTypes()

Gets all entity types defined in the model.

IEnumerable<IMutableEntityType> GetEntityTypes()
Function GetEntityTypes As IEnumerable(Of IMutableEntityType)
Returns
System.Collections.Generic.IEnumerable<IMutableEntityType> System.Collections.Generic.IEnumerable(Of IMutableEntityType)

All entity types defined in the model.

RemoveEntityType(String) RemoveEntityType(String)

Removes an entity type from the model.

IMutableEntityType RemoveEntityType(string name)
Function RemoveEntityType(name As String) As IMutableEntityType
Parameters
name
System.String System.String

The name of the entity type to be removed.

Returns

The entity type that was removed.