IMutableModel IMutableModel Interface

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.

Syntax

Declaration

public interface IMutableModel : IModel, IMutableAnnotatable, IAnnotatablePublic Interface IMutableModel
    Inherits IModel, IMutableAnnotatable

Inherited Members

Item[String],
Item(String),
GetAnnotations(),
GetAnnotations(),
AddAnnotation(String, Object),
AddAnnotation(String, Object),
FindAnnotation(String),
FindAnnotation(String),
RemoveAnnotation(String)
RemoveAnnotation(String)

Methods summary

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.

Adds an entity type to the model.

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

Gets all entity types defined in the model.

Removes an entity type from the model.

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

  • 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

  • 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

  • GetEntityTypes()
    GetEntityTypes()

    Gets all entity types defined in the model.

    IEnumerable<IMutableEntityType> GetEntityTypes()Function GetEntityTypes As IEnumerable(Of IMutableEntityType)

    Returns

  • 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

Details

Assembly

Microsoft.EntityFrameworkCore.dll