IReadOnlyEntityType Interface

Definition

Represents an entity type in a model.

public interface IReadOnlyEntityType : Microsoft.EntityFrameworkCore.Metadata.IReadOnlyTypeBase
type IReadOnlyEntityType = interface
    interface IReadOnlyTypeBase
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyEntityType
Implements IReadOnlyTypeBase
Derived
Implements

Remarks

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

Properties

BaseType

Gets the base type of this entity type. Returns null if this is not a derived type in an inheritance hierarchy.

ClrType

Gets the CLR class that is used to represent instances of this type. Returns null if the type does not have a corresponding CLR class (known as a shadow type).

(Inherited from IReadOnlyTypeBase)
ContainingEntityType

Gets this entity type or the one on which the complex property chain is declared.

(Inherited from IReadOnlyTypeBase)
DefiningEntityType
Obsolete.

Gets the defining entity type.

DefiningNavigationName
Obsolete.

Gets the name of the defining navigation.

HasSharedClrType

Gets a value indicating whether this structural type is mapped to a Type that other structural types are also mapped to.

(Inherited from IReadOnlyTypeBase)
IsPropertyBag

Gets a value indicating whether this structural 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.

(Inherited from IReadOnlyTypeBase)
Item[String]

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

(Inherited from IReadOnlyAnnotatable)
Model

Gets the model that this type belongs to.

(Inherited from IReadOnlyTypeBase)
Name

Gets the name of this type.

(Inherited from IReadOnlyTypeBase)

Methods

AnnotationsToDebugString(Int32)

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

(Inherited from IReadOnlyAnnotatable)
DisplayName()

Gets the friendly display name for this structural type.

(Inherited from IReadOnlyTypeBase)
DisplayName(Boolean)

Gets the friendly display name for the given IReadOnlyTypeBase.

(Inherited from IReadOnlyTypeBase)
FindAnnotation(String)

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

(Inherited from IReadOnlyAnnotatable)
FindClosestCommonParent(IReadOnlyEntityType)

Returns the closest entity type that is a parent of both given entity types. If one of the given entities is a parent of the other, that parent is returned. Returns null if the two entity types aren't in the same hierarchy.

FindComplexProperty(MemberInfo)

Gets a complex property with the given member info. Returns null if no property is found.

(Inherited from IReadOnlyTypeBase)
FindComplexProperty(String)

Gets the complex property with the given name. Returns null if no property with the given name is defined.

(Inherited from IReadOnlyTypeBase)
FindDeclaredComplexProperty(String)

Finds a property declared on the type with the given name. Does not return properties defined on a base type.

(Inherited from IReadOnlyTypeBase)
FindDeclaredForeignKeys(IReadOnlyList<IReadOnlyProperty>)

Gets the foreign keys declared on this entity type using the given properties.

FindDeclaredNavigation(String)

Gets a navigation property on the given entity type. Does not return navigation properties defined on a base type. Returns null if no navigation property is found.

FindDeclaredProperty(String)

Finds a property declared on the type with the given name. Does not return properties defined on a base type.

FindDeclaredSkipNavigation(String)

Gets a skip navigation property on this entity type.

FindDeclaredTrigger(String)

Finds a trigger with the given name.

FindDiscriminatorProperty()

Returns the property that will be used for storing a discriminator value.

FindForeignKey(IReadOnlyList<IReadOnlyProperty>, IReadOnlyKey, IReadOnlyEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

FindForeignKey(IReadOnlyProperty, IReadOnlyKey, IReadOnlyEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

FindForeignKeys(IReadOnlyList<IReadOnlyProperty>)

Gets the foreign keys defined on the given properties. Only foreign keys that are defined on exactly the specified set of properties are returned.

FindForeignKeys(IReadOnlyProperty)

Gets the foreign keys defined on the given property. Only foreign keys that are defined on exactly the specified property are returned. Composite foreign keys that include the specified property are not returned.

FindIndex(IReadOnlyList<IReadOnlyProperty>)

Gets the unnamed index defined on the given properties. Returns null if no such index is defined.

FindIndex(IReadOnlyProperty)

Gets the unnamed index defined on the given property. Returns null if no such index is defined.

FindIndex(String)

Gets the index with the given name. Returns null if no such index exists.

FindIndexerPropertyInfo()

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

(Inherited from IReadOnlyTypeBase)
FindKey(IReadOnlyList<IReadOnlyProperty>)

Gets the primary or alternate key that is defined on the given properties. Returns null if no key is defined for the given properties.

FindKey(IReadOnlyProperty)

Gets the primary or alternate key that is defined on the given property. Returns null if no key is defined for the given property.

FindMember(String)

Gets the member with the given name. Returns null if no member with the given name is defined.

(Inherited from IReadOnlyTypeBase)
FindMembersInHierarchy(String)

Gets the members with the given name on this type, base types or derived types.

(Inherited from IReadOnlyTypeBase)
FindNavigation(MemberInfo)

Gets a navigation property on the given entity type. Returns null if no navigation property is found.

FindNavigation(String)

Gets a navigation property on the given entity type. Returns null if no navigation property is found.

FindOwnership()

Returns the relationship to the owner if this is an owned type or null otherwise.

FindPrimaryKey()

Gets primary key for this entity type. Returns null if no primary key is defined.

FindProperties(IReadOnlyList<String>)

Finds matching properties on the given entity type. Returns null if any property is not found.

FindProperty(MemberInfo)

Gets a property with the given member info. Returns null if no property is found.

FindProperty(String)

Gets the property with a given name. Returns null if no property with the given name is defined.

FindServiceProperty(String)

Gets the service property with a given name. Returns null if no property with the given name is defined.

FindSkipNavigation(MemberInfo)

Gets a skip navigation property on this entity type. Returns null if no navigation property is found.

FindSkipNavigation(String)

Gets a skip navigation property on this entity type. Returns null if no skip navigation property is found.

GetAllBaseTypes()

Gets all types in the model from which this entity type derives, starting with the root.

GetAllBaseTypesAscending()

Gets all types in the model from which this entity type derives, starting with the closest one.

GetAllBaseTypesInclusive()

Returns all base types of this entity type, including the type itself, top to bottom.

GetAllBaseTypesInclusiveAscending()

Returns all base types of this entity type, including the type itself, bottom to top.

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 change tracking strategy being used for this entity type. This strategy indicates how the context detects changes to properties for an instance of the entity type.

GetComplexProperties()

Gets the complex properties defined on this type and base types.

(Inherited from IReadOnlyTypeBase)
GetConcreteDerivedTypesInclusive()

Returns all the derived types of this entity type, including the type itself, which are not abstract.

GetDeclaredComplexProperties()

Gets the complex properties declared on this type.

(Inherited from IReadOnlyTypeBase)
GetDeclaredForeignKeys()

Gets all foreign keys declared on this entity type..

GetDeclaredIndexes()

Gets all indexes declared on this entity type.

GetDeclaredKeys()

Gets all keys declared on this entity type.

GetDeclaredMembers()

Gets the members declared on this type.

(Inherited from IReadOnlyTypeBase)
GetDeclaredNavigations()

Gets all navigation properties declared on this entity type.

GetDeclaredProperties()

Gets all non-navigation properties declared on this entity type.

GetDeclaredReferencingForeignKeys()

Gets all foreign keys that target a given entity type (i.e. foreign keys where the given entity type is the principal).

GetDeclaredServiceProperties()

Gets all service properties declared on this entity type.

GetDeclaredSkipNavigations()

Gets all skip navigation properties declared on this entity type.

GetDeclaredTriggers()

Returns the declared triggers on the entity type.

GetDefaultDiscriminatorValue()

Returns the default discriminator value that would be used for this entity type.

GetDerivedComplexProperties()

Gets the complex properties declared on the types derived from this type.

(Inherited from IReadOnlyTypeBase)
GetDerivedForeignKeys()

Gets all foreign keys declared on the types derived from this entity type.

GetDerivedIndexes()

Gets all indexes declared on the types derived from this entity type.

GetDerivedNavigations()

Gets all navigation properties declared on the types derived from this entity type.

GetDerivedProperties()

Gets all non-navigation properties declared on the types derived from this entity type.

GetDerivedServiceProperties()

Gets all service properties declared on the types derived from this entity type.

GetDerivedSkipNavigations()

Gets all skip navigation properties declared on the types derived from this entity type.

GetDerivedTypes()

Gets all types in the model that derive from this entity type.

GetDerivedTypesInclusive()

Returns all derived types of this entity type, including the type itself.

GetDirectlyDerivedTypes()

Gets all types in the model that directly derive from this entity type.

GetDiscriminatorPropertyName()

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

GetDiscriminatorValue()

Returns the discriminator value for this entity type.

GetForeignKeys()

Gets the foreign keys defined on this entity type.

GetIndexes()

Gets the indexes defined on this entity type.

GetIsDiscriminatorMappingComplete()

Returns the value indicating whether the discriminator mapping is complete for this entity type.

GetKeys()

Gets the primary and alternate keys for this entity type.

GetMembers()

Gets the members defined on this type and base types.

(Inherited from IReadOnlyTypeBase)
GetNavigationAccessMode()

Gets the PropertyAccessMode being used for navigations of this entity type.

GetNavigations()

Gets all navigation properties on the given entity type.

GetOrCreateEmptyMaterializer(IEntityMaterializerSource)

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.

GetOrCreateMaterializer(IEntityMaterializerSource)

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.

GetProperties()

Gets the properties defined on this entity type.

GetProperty(String)

Gets a property with the given name.

GetPropertyAccessMode()

Gets the PropertyAccessMode being used for properties and navigations of this type.

(Inherited from IReadOnlyTypeBase)
GetQueryFilter()

Gets the LINQ expression filter automatically applied to queries for this entity type.

GetReferencingForeignKeys()

Gets all foreign keys that target a given entity type (i.e. foreign keys where the given entity type or a base type is the principal).

GetRootType()

Gets the root base type for a given entity type.

GetSeedData(Boolean)

Gets the data stored in the model for the given entity type.

GetServiceProperties()

Gets all the IReadOnlyServiceProperty defined on this entity type.

GetSkipNavigations()

Gets the skip navigation properties on this entity type.

HasDefiningNavigation()
Obsolete.

Gets a value indicating whether this entity type has a defining navigation.

HasServiceProperties()

Checks whether or not this entity type has any IServiceProperty defined.

IsAbstract()

Gets a value indicating whether this structural type represents an abstract type.

(Inherited from IReadOnlyTypeBase)
IsAssignableFrom(IReadOnlyEntityType)

Determines if this entity type derives from (or is the same as) a given entity type.

IsAssignableFrom(IReadOnlyTypeBase)

Determines if this type derives from (or is the same as) a given type.

(Inherited from IReadOnlyTypeBase)
IsInOwnershipPath(IReadOnlyEntityType)

Gets a value indicating whether given entity type is in ownership path for this entity type.

IsOwned()

Gets a value indicating whether this entity type is owned by another entity type.

IsStrictlyDerivedFrom(IReadOnlyEntityType)

Determines if this entity type derives from (but is not the same as) a given entity type.

IsStrictlyDerivedFrom(IReadOnlyTypeBase)

Determines if this type derives from (but is not the same as) a given type.

(Inherited from IReadOnlyTypeBase)
LeastDerivedType(IReadOnlyEntityType)

Gets the least derived type between the specified two.

ShortName()

Gets a short name for the given IReadOnlyTypeBase that can be used in other identifiers.

(Inherited from IReadOnlyTypeBase)
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.

Explicit Interface Implementations

IReadOnlyTypeBase.IsAssignableFrom(IReadOnlyTypeBase)

Determines if this type derives from (or is the same as) a given type.

Extension Methods

GetAnalyticalStoreTimeToLive(IReadOnlyEntityType)

Returns the time to live for analytical store in seconds at container scope.

GetContainer(IReadOnlyEntityType)

Returns the name of the container to which the entity type is mapped.

GetContainingPropertyName(IReadOnlyEntityType)

Returns the name of the parent property to which the entity type is mapped.

GetDefaultTimeToLive(IReadOnlyEntityType)

Returns the default time to live in seconds at container scope.

GetETagProperty(IReadOnlyEntityType)

Gets the property on this entity that is mapped to Cosmos ETag, if it exists.

GetETagPropertyName(IReadOnlyEntityType)

Returns the name of the property that is used to store the ETag.

GetPartitionKeyProperty(IReadOnlyEntityType)

Returns the property that is used to store the partition key.

GetPartitionKeyPropertyName(IReadOnlyEntityType)

Returns the name of the property that is used to store the partition key.

GetThroughput(IReadOnlyEntityType)

Returns the provisioned throughput at container scope.

GetInMemoryQuery(IReadOnlyEntityType)

Gets the LINQ query used as the default source for queries of this type.

FindCheckConstraint(IReadOnlyEntityType, String)

Finds an IReadOnlyCheckConstraint with the given name.

FindMappingFragment(IReadOnlyEntityType, StoreObjectIdentifier)

Returns the entity type mapping for a particular table-like store object.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

FindRowInternalForeignKeys(IReadOnlyEntityType, StoreObjectIdentifier)

Gets the foreign keys for the given entity type that point to other entity types sharing the same table-like store object.

GetCheckConstraints(IReadOnlyEntityType)

Returns all check constraints contained in the entity type.

GetComment(IReadOnlyEntityType)

Returns the comment for the table this entity is mapped to.

GetContainerColumnName(IReadOnlyEntityType)

Gets the container column name to which the entity type is mapped.

GetContainerColumnTypeMapping(IReadOnlyEntityType)
Obsolete.

Gets the container column type mapping to which the entity type is mapped.

GetDeclaredCheckConstraints(IReadOnlyEntityType)

Returns all check constraints declared on the entity type.

GetDefaultSchema(IReadOnlyEntityType)

Returns the default database schema that would be used for this entity type.

GetDefaultSqlQueryName(IReadOnlyEntityType)

Gets the default SQL query name that would be used for this entity type when mapped using RelationalEntityTypeBuilderExtensions.ToSqlQuery.

GetDefaultTableName(IReadOnlyEntityType, Boolean)

Returns the default table name that would be used for this entity type.

GetDefaultViewName(IReadOnlyEntityType)

Returns the default view name that would be used for this entity type.

GetDefaultViewSchema(IReadOnlyEntityType)

Returns the default database schema that would be used for this entity view.

GetDeleteStoredProcedure(IReadOnlyEntityType)

Returns the stored procedure to which the entity type is mapped for deletes or null if not mapped to a stored procedure.

GetFunctionName(IReadOnlyEntityType)

Returns the name of the function to which the entity type is mapped or null if not mapped to a function.

GetInsertStoredProcedure(IReadOnlyEntityType)

Returns the stored procedure to which the entity type is mapped for inserts or null if not mapped to a stored procedure.

GetJsonPropertyName(IReadOnlyEntityType)

Gets the value of JSON property name used for the given entity mapped to a JSON column.

GetMappingFragments(IReadOnlyEntityType)

Returns all configured entity type mapping fragments.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetMappingFragments(IReadOnlyEntityType, StoreObjectType)

Returns all configured entity type mapping fragments of the given type.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetMappingStrategy(IReadOnlyEntityType)

Gets the mapping strategy for the derived types.

GetSchema(IReadOnlyEntityType)

Returns the database schema that contains the mapped table.

GetSchemaQualifiedTableName(IReadOnlyEntityType)

Returns the name of the table to which the entity type is mapped prepended by the schema or null if not mapped to a table.

GetSchemaQualifiedViewName(IReadOnlyEntityType)

Returns the name of the view to which the entity type is mapped prepended by the schema or null if not mapped to a view.

GetSqlQuery(IReadOnlyEntityType)

Returns the SQL string used to provide data for the entity type or null if not mapped to a SQL string.

GetTableName(IReadOnlyEntityType)

Returns the name of the table to which the entity type is mapped or null if not mapped to a table.

GetUpdateStoredProcedure(IReadOnlyEntityType)

Returns the stored procedure to which the entity type is mapped for updates or null if not mapped to a stored procedure.

GetViewName(IReadOnlyEntityType)

Returns the name of the view to which the entity type is mapped or null if not mapped to a view.

GetViewSchema(IReadOnlyEntityType)

Returns the database schema that contains the mapped view.

IsMappedToJson(IReadOnlyEntityType)

Gets a value indicating whether the specified entity is mapped to a JSON column.

IsTableExcludedFromMigrations(IReadOnlyEntityType)

Gets a value indicating whether the associated table is ignored by Migrations.

IsTableExcludedFromMigrations(IReadOnlyEntityType, StoreObjectIdentifier)

Gets a value indicating whether the specified table is ignored by Migrations.

FindMappingFragment(IReadOnlyTypeBase, StoreObjectIdentifier)

Returns the type mapping for a particular table-like store object.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetContainerColumnName(IReadOnlyTypeBase)

Gets the container column name to which the type is mapped.

GetDeleteStoredProcedure(IReadOnlyTypeBase)

Returns the stored procedure to which the type is mapped for deletes or null if not mapped to a stored procedure.

GetFunctionName(IReadOnlyTypeBase)

Returns the name of the function to which the type is mapped or null if not mapped to a function.

GetInsertStoredProcedure(IReadOnlyTypeBase)

Returns the stored procedure to which the type is mapped for inserts or null if not mapped to a stored procedure.

GetJsonPropertyName(IReadOnlyTypeBase)

Gets the value of JSON property name used for the given entity mapped to a JSON column.

GetMappingFragments(IReadOnlyTypeBase)

Returns all configured type mapping fragments.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetMappingFragments(IReadOnlyTypeBase, StoreObjectType)

Returns all configured type mapping fragments of the given type.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetMappingStrategy(IReadOnlyTypeBase)

Gets the mapping strategy for the derived types.

GetSchema(IReadOnlyTypeBase)

Returns the database schema that contains the mapped table.

GetSqlQuery(IReadOnlyTypeBase)

Returns the SQL string used to provide data for the type or null if not mapped to a SQL string.

GetTableName(IReadOnlyTypeBase)

Returns the name of the table to which the type is mapped or null if not mapped to a table.

GetUpdateStoredProcedure(IReadOnlyTypeBase)

Returns the stored procedure to which the type is mapped for updates or null if not mapped to a stored procedure.

GetViewName(IReadOnlyTypeBase)

Returns the name of the view to which the type is mapped or null if not mapped to a view.

GetViewSchema(IReadOnlyTypeBase)

Returns the database schema that contains the mapped view.

IsMappedToJson(IReadOnlyTypeBase)

Gets a value indicating whether the specified entity is mapped to a JSON column.

GetDbSetName(IReadOnlyEntityType)

Gets the name that should be used for the DbSet<TEntity> property on the DbContext class for this entity type.

IsSqlReturningClauseUsed(IReadOnlyEntityType)

Returns a value indicating whether to use the SQL RETURNING clause when saving changes to the table. The RETURNING clause is incompatible with certain Sqlite features, such as virtual tables or tables with AFTER triggers.

IsSqlReturningClauseUsed(IReadOnlyEntityType, StoreObjectIdentifier)

Returns a value indicating whether to use the SQL RETURNING clause when saving changes to the table. The RETURNING clause is incompatible with certain Sqlite features, such as virtual tables or tables with AFTER triggers.

GetHistoryTableName(IReadOnlyEntityType)

Returns a value representing the name of the history table associated with the entity mapped to a temporal table.

GetHistoryTableSchema(IReadOnlyEntityType)

Returns a value representing the schema of the history table associated with the entity mapped to a temporal table.

GetPeriodEndPropertyName(IReadOnlyEntityType)

Returns a value representing the name of the period end property of the entity mapped to a temporal table.

GetPeriodStartPropertyName(IReadOnlyEntityType)

Returns a value representing the name of the period start property of the entity mapped to a temporal table.

IsMemoryOptimized(IReadOnlyEntityType)

Returns a value indicating whether the entity type is mapped to a memory-optimized table.

IsSqlOutputClauseUsed(IReadOnlyEntityType)

Returns a value indicating whether to use the SQL OUTPUT clause when saving changes to the table. The OUTPUT clause is incompatible with certain SQL Server features, such as tables with triggers.

IsSqlOutputClauseUsed(IReadOnlyEntityType, StoreObjectIdentifier)

Returns a value indicating whether to use the SQL OUTPUT clause when saving changes to the specified table. The OUTPUT clause is incompatible with certain SQL Server features, such as tables with triggers.

IsTemporal(IReadOnlyEntityType)

Returns a value indicating whether the entity type is mapped to a temporal table.

Applies to