IEntityType Interface

Definition

Represents an entity type in an IModel.

public interface IEntityType : Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable
public interface IEntityType : Microsoft.EntityFrameworkCore.Metadata.ITypeBase
type IEntityType = interface
    interface IAnnotatable
type IEntityType = interface
    interface ITypeBase
    interface IAnnotatable
Public Interface IEntityType
Implements IAnnotatable
Public Interface IEntityType
Implements ITypeBase
Derived
Implements

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).

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

DefiningEntityType

Gets the defining entity type.

DefiningNavigationName

Gets the name of the defining navigation.

DefiningQuery

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

HasSharedClrType

Gets whether this entity type can share its ClrType with other entities.

(Inherited from ITypeBase)
IsPropertyBag

Gets whether this entity type has an indexer which is able to contain arbitrary properties.

(Inherited from ITypeBase)
IsQueryType

Gets whether this entity type is a query type.

Item[String]

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

(Inherited from IAnnotatable)
Model

Gets the model that this type belongs to.

Name

Gets the name of this type.

QueryFilter

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

Methods

FindAnnotation(String)

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

(Inherited from IAnnotatable)
FindDeclaredSkipNavigation(String)

Gets a skip navigation property on this entity type.

Does not return skip navigation properties defined on a base type. Returns null if no skip navigation property is found.

FindForeignKey(IReadOnlyList<IProperty>, IKey, IEntityType)

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.

FindIndex(IReadOnlyList<IProperty>)

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

Named indexes will not be returned even if the list of properties matches.

FindIndex(String)

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

FindKey(IReadOnlyList<IProperty>)

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

FindPrimaryKey()

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

FindProperty(String)

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

This API only finds scalar properties and does not find navigation properties. Use FindNavigation(IEntityType, String) to find a navigation property.

FindServiceProperty(String)

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

This API only finds service properties and does not find scalar or navigation properties.

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.

GetAnnotations()

Gets all annotations on the current object.

(Inherited from IAnnotatable)
GetDeclaredSkipNavigations()

Gets all skip navigation properties declared on this entity type.

This method does not return skip navigation properties declared declared on base types. It is useful when iterating over all entity types to avoid processing the same foreign key more than once. Use GetSkipNavigations() to also return skip navigation properties declared on base types.

GetForeignKeys()

Gets the foreign keys defined on this entity type.

GetIndexes()

Gets the indexes defined on this entity type.

GetKeys()

Gets the primary and alternate keys for this entity type.

GetProperties()

Gets the properties defined on this entity type.

This API only returns scalar properties and does not return navigation properties. Use GetNavigations(IEntityType) to get navigation properties.

GetServiceProperties()

Gets all the IServiceProperty defined on this entity type.

This API only returns service properties and does not return scalar or navigation properties.

GetSkipNavigations()

Gets the skip navigation properties on this entity type.

Extension Methods

GetContainer(IEntityType)

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

GetContainingPropertyName(IEntityType)

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

GetETagProperty(IEntityType)

Gets the IProperty on this entity that is mapped to cosmos etag, if it exists.

GetETagPropertyName(IEntityType)

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

GetPartitionKeyPropertyName(IEntityType)

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

DisplayName(ITypeBase)

Gets the friendly display name for the given ITypeBase.

FindDeclaredNavigation(IEntityType, 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(IEntityType, String)

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

FindDefiningNavigation(IEntityType)

Returns the defining navigation if one exists or null otherwise.

FindForeignKey(IEntityType, IProperty, IKey, IEntityType)

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(IEntityType, IProperty)

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.

FindForeignKeys(IEntityType, IReadOnlyList<IProperty>)

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

FindIndex(IEntityType, IProperty)

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

Named indexes will not be returned even if the list of properties matches.

FindKey(IEntityType, IProperty)

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

FindNavigation(IEntityType, MemberInfo)

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

FindNavigation(IEntityType, PropertyInfo)

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

FindNavigation(IEntityType, String)

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

FindOwnership(IEntityType)

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

FindProperties(IEntityType, IReadOnlyList<String>)

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

This API only finds scalar properties and does not find navigation properties.

FindProperty(IEntityType, MemberInfo)

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

This API only finds scalar properties and does not find navigation properties. Use FindNavigation(IEntityType, MemberInfo) to find a navigation property.

FindProperty(IEntityType, PropertyInfo)

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

This API only finds scalar properties and does not find navigation properties. Use FindNavigation(IEntityType, PropertyInfo) to find a navigation property.

FullName(ITypeBase)

Gets the unique name for the given ITypeBase.

GetAllBaseTypes(IEntityType)

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

GetAllBaseTypesAscending(IEntityType)

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

GetAllBaseTypesInclusive(IEntityType)

Returns all base types of the given IEntityType, including the type itself, top to bottom.

GetAllBaseTypesInclusiveAscending(IEntityType)

Returns all base types of the given IEntityType, including the type itself, bottom to top.

GetChangeTrackingStrategy(IEntityType)

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.

GetClosestCommonParent(IEntityType, IEntityType)

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.

GetConcreteDerivedTypesInclusive(IEntityType)

Returns all the derived types of the given IEntityType, including the type itself, which are not abstract.

GetDeclaredForeignKeys(IEntityType)

Gets all foreign keys declared on the given IEntityType.

This method does not return foreign keys declared on base types. It is useful when iterating over all entity types to avoid processing the same foreign key more than once. Use GetForeignKeys() to also return foreign keys declared on base types.

GetDeclaredIndexes(IEntityType)

Gets all indexes declared on the given IEntityType.

This method does not return indexes declared on base types. It is useful when iterating over all entity types to avoid processing the same index more than once. Use GetForeignKeys() to also return indexes declared on base types.

GetDeclaredKeys(IEntityType)

Gets all keys declared on the given IEntityType.

This method does not return keys declared on base types. It is useful when iterating over all entity types to avoid processing the same key more than once. Use GetKeys() to also return keys declared on base types.

GetDeclaredNavigations(IEntityType)

Gets all navigation properties declared on the given IEntityType.

This method does not return navigation properties declared on base types. It is useful when iterating over all entity types to avoid processing the same navigation property more than once. Use GetNavigations(IEntityType) to also return navigation properties declared on base types.

GetDeclaredProperties(IEntityType)

Gets all non-navigation properties declared on the given IEntityType.

This method does not return properties declared on base types. It is useful when iterating over all entity types to avoid processing the same property more than once. Use GetProperties() to also return properties declared on base types.

GetDeclaredReferencingForeignKeys(IEntityType)

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

GetDeclaredServiceProperties(IEntityType)

Gets all service properties declared on the given IEntityType.

This method does not return properties declared on base types. It is useful when iterating over all entity types to avoid processing the same property more than once. Use GetServiceProperties() to also return properties declared on base types.

GetDefiningQuery(IEntityType)
Obsolete.

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

GetDerivedForeignKeys(IEntityType)

Gets all foreign keys declared on the types derived from the given IEntityType.

This method does not return foreign keys declared on the given entity type itself. Use GetForeignKeys() to return foreign keys declared on this and base entity typed types.

GetDerivedTypes(IEntityType)

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

GetDerivedTypesInclusive(IEntityType)

Returns all derived types of the given IEntityType, including the type itself.

GetDirectlyDerivedTypes(IEntityType)

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

GetDiscriminatorProperty(IEntityType)

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

GetDiscriminatorValue(IEntityType)

Returns the discriminator value for this entity type.

GetIsDiscriminatorMappingComplete(IEntityType)

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

GetNavigations(IEntityType)

Gets all navigation properties on the given entity type.

GetProperty(IEntityType, String)

Gets a property with the given name.

This API only finds scalar properties and does not find navigation properties. Use FindNavigation(IEntityType, String) to find a navigation property.

GetQueryFilter(IEntityType)

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

GetReferencingForeignKeys(IEntityType)

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

GetRootType(IEntityType)

Gets the root base type for a given entity type.

GetSeedData(IEntityType, Boolean)

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

HasDefiningNavigation(IEntityType)

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

IsAbstract(ITypeBase)

Checks if this entity type represents an abstract type.

IsAssignableFrom(IEntityType, IEntityType)

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

IsInOwnershipPath(IEntityType, IEntityType)

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

IsOwned(IEntityType)

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

IsStrictlyDerivedFrom(IEntityType, IEntityType)

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

LeastDerivedType(IEntityType, IEntityType)

Gets the least derived type between the specified two.

RootType(IEntityType)
Obsolete.

Gets the root base type for a given entity type.

ShortName(ITypeBase)

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

ToDebugString(IEntityType, 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.

AnnotationsToDebugString(IAnnotatable, Int32)

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

GetAnnotation(IAnnotatable, String)

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

GetInMemoryQuery(IEntityType)

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

FindCheckConstraint(IEntityType, String)

Finds an ICheckConstraint with the given name.

FindRowInternalForeignKeys(IEntityType, StoreObjectIdentifier)

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

GetCheckConstraints(IEntityType)

Returns all ICheckConstraint contained in the entity type.

GetComment(IEntityType)

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

GetDefaultMappings(IEntityType)

Returns the default mappings that the entity type would use.

GetDefaultSchema(IEntityType)

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

GetDefaultSqlQueryName(IEntityType)

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

GetDefaultTableName(IEntityType)

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

GetDefaultTableName(IEntityType, Boolean)

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

GetDefaultViewName(IEntityType)

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

GetDefaultViewSchema(IEntityType)

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

GetFunctionMappings(IEntityType)

Returns the functions to which the entity type is mapped.

GetFunctionName(IEntityType)

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

GetSchema(IEntityType)

Returns the database schema that contains the mapped table.

GetSchemaQualifiedTableName(IEntityType)

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(IEntityType)

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(IEntityType)

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

GetSqlQueryMappings(IEntityType)

Returns the SQL string mappings.

GetTableMappings(IEntityType)

Returns the tables to which the entity type is mapped.

GetTableName(IEntityType)

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

GetViewMappings(IEntityType)

Returns the views to which the entity type is mapped.

GetViewName(IEntityType)

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

GetViewSchema(IEntityType)

Returns the database schema that contains the mapped view.

IsIgnoredByMigrations(IEntityType)

Gets a value indicating whether the entity type is ignored by Migrations.

IsTableExcludedFromMigrations(IEntityType)

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

Relational(IEntityType)

Gets the relational database specific metadata for an entity.

Sqlite(IEntityType)

Gets the SQLite specific metadata for an entity.

IsMemoryOptimized(IEntityType)

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

SqlServer(IEntityType)

Gets the SQL Server specific metadata for an entity.

GetNavigationAccessMode(ITypeBase)

Gets the PropertyAccessMode being used for navigations of this type.

Note that individual navigations can override this access mode. The value returned here will be used for any navigation for which no override has been specified.

GetPropertyAccessMode(ITypeBase)

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

Note that individual properties and navigations can override this access mode. The value returned here will be used for any property or navigation for which no override has been specified.

Applies to