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.

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)
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 index defined on the given properties. Returns null if no index is defined.

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.

GetAnnotations()

Gets all annotations on the current object.

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

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.

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 index defined on the given property. Returns null if no index is defined.

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

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

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.

GetNavigations(IEntityType)

Gets all navigation properties on the given entity type.

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 an entity type derives from (or is the same as) a given entity type.

IsOwned(IEntityType)

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

IsStrictlyDerivedFrom(IEntityType, IEntityType)

Determines if an 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)

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.

GetAnnotation(IAnnotatable, String)

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

FindCheckConstraint(IEntityType, String)

Finds an ICheckConstraint with the given name.

GetCheckConstraints(IEntityType)

Returns all ICheckConstraint contained in the entity type.

GetComment(IEntityType)

Returns the comment for the column this property is mapped to.

GetDefaultSchema(IEntityType)

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

GetDefaultTableName(IEntityType)

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

GetSchema(IEntityType)

Returns the database schema that contains the mapped table.

GetTableName(IEntityType)

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

IsIgnoredByMigrations(IEntityType)

Gets a value indicating whether the entity type 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