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

Methods

AddAnnotation(String, Object) AddAnnotation(String, Object)

Adds an annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from IMutableAnnotatable)

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.

FindAnnotation(String) FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from IMutableAnnotatable)

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.

GetAnnotations() GetAnnotations()

Gets all annotations on the current object.

(Inherited from IMutableAnnotatable)

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.

RemoveAnnotation(String) RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from IMutableAnnotatable)

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.

Properties

Item[String] Item(String)

Gets or sets the value of the annotation with the given name.

(Inherited from IMutableAnnotatable)