Compartilhar via


IReadOnlyModel 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 OnModelCreating(ModelBuilder) method on a derived DbContext.

public interface IReadOnlyModel : Microsoft.EntityFrameworkCore.Infrastructure.IReadOnlyAnnotatable
type IReadOnlyModel = interface
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyModel
Implements IReadOnlyAnnotatable
Derived
Implements

Remarks

See Modeling entity types and relationships for more information and examples.

Properties

Item[String]

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

(Inherited from IReadOnlyAnnotatable)
ModelId

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Methods

AnnotationsToDebugString(Int32)

Gets the debug string for all annotations declared on the object.

(Inherited from IReadOnlyAnnotatable)
FindAnnotation(String)

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

(Inherited from IReadOnlyAnnotatable)
FindEntityType(String, String, IReadOnlyEntityType)

Gets the entity type for the given base name, defining navigation name and the defining entity type. Returns null if no matching entity type is found.

FindEntityType(String)

Gets the entity type with the given name. Returns null if no entity type with the given name is found or the given CLR type is being used by shared type entity type or the entity type has a defining navigation.

FindEntityType(Type, String, IReadOnlyEntityType)

Gets the entity type for the given type, defining navigation name and the defining entity type. Returns null if no matching entity type is found.

FindEntityType(Type)

Gets the entity that maps the given entity class. Returns null if no entity type with the given CLR type is found or the given CLR type is being used by shared type entity type or the entity type has a defining navigation.

FindEntityTypes(Type)

Gets the entity types matching the given type.

FindLeastDerivedEntityTypes(Type, Func<IReadOnlyEntityType,Boolean>)

Returns the entity types corresponding to the least derived types from the given.

GetAnnotation(String)

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

(Inherited from IReadOnlyAnnotatable)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from IReadOnlyAnnotatable)
GetChangeTrackingStrategy()

Gets the default change tracking strategy being used for entities in the model. This strategy indicates how the context detects changes to properties for an instance of an entity type.

GetEmbeddedDiscriminatorName()

Gets the name to use for discriminator properties embedded in JSON documents. The default is "$type".

GetEntityTypes()

Gets all entity types defined in the model.

GetProductVersion()

Gets the EF Core assembly version used to build this model.

GetPropertyAccessMode()

Gets the PropertyAccessMode being used for properties of entity types in this model.

IsShared(Type)

Gets a value indicating whether the CLR type is used by shared type entities in the model.

ToDebugString(MetadataDebugStringOptions, Int32)

Creates a human-readable representation of the given metadata.

Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.

Extension Methods

GetDefaultContainer(IReadOnlyModel)

Returns the default container name.

GetDiscriminatorInKey(IReadOnlyModel)

Returns a value indicating whether the entity type discriminator should be included in the JSON "id" value. Prior to EF Core 9, it was always included. Starting with EF Core 9, it is not included by default.

GetHasShadowIds(IReadOnlyModel)

Returns a value indicating whether the setting for always creating the "__id" property can be set from the current configuration source

GetThroughput(IReadOnlyModel)

Returns the provisioned throughput at database scope.

FindDbFunction(IReadOnlyModel, MethodInfo)

Finds a function that is mapped to the method represented by the given MethodInfo.

FindDbFunction(IReadOnlyModel, String)

Finds a function that is mapped to the method represented by the given name.

FindSequence(IReadOnlyModel, String, String)

Finds a sequence with the given name.

GetCollation(IReadOnlyModel)

Returns the database collation.

GetDbFunctions(IReadOnlyModel)

Returns all functions contained in the model.

GetDefaultSchema(IReadOnlyModel)

Returns the default schema to use for the model, or null if none has been set.

GetMaxIdentifierLength(IReadOnlyModel)

Returns the maximum length allowed for store identifiers.

GetSequences(IReadOnlyModel)

Returns all sequences contained in the model.

GetDatabaseMaxSize(IReadOnlyModel)

Returns the maximum size of the database.

GetHiLoSequenceName(IReadOnlyModel)

Returns the name to use for the default hi-lo sequence.

GetHiLoSequenceSchema(IReadOnlyModel)

Returns the schema to use for the default hi-lo sequence. UseHiLo(PropertyBuilder, String, String)

GetIdentityIncrement(IReadOnlyModel)

Returns the default identity increment.

GetIdentitySeed(IReadOnlyModel)

Returns the default identity seed.

GetPerformanceLevelSql(IReadOnlyModel)

Returns the performance level of the database.

GetSequenceNameSuffix(IReadOnlyModel)

Returns the suffix to append to the name of automatically created sequences.

GetSequenceSchema(IReadOnlyModel)

Returns the schema to use for the default value generation sequence. UseSequence(PropertyBuilder, String, String)

GetServiceTierSql(IReadOnlyModel)

Returns the service tier of the database.

GetValueGenerationStrategy(IReadOnlyModel)

Returns the SqlServerValueGenerationStrategy to use for properties of keys in the model, unless the property has a strategy explicitly set.

Applies to