IEntityType IEntityType Interface

Definition

Represents an entity type in an IModel.

public interface IEntityType : ITypeBase, IAnnotatable
Public Interface IEntityType
    Inherits ITypeBase

Properties

BaseType BaseType

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

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

Item[String] Item(String)

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

(Inherited from IAnnotatable)
Model Model

Gets the model that this type belongs to.

Name Name

Gets the name of this type.

Methods

FindAnnotation(String) FindAnnotation(String)

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

(Inherited from IAnnotatable)
FindForeignKey(IReadOnlyList<IProperty>, IKey, IEntityType) FindForeignKey(IReadOnlyList(Of 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>) FindIndex(IReadOnlyList(Of IProperty))

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

FindKey(IReadOnlyList<IProperty>) FindKey(IReadOnlyList(Of 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() FindPrimaryKey()

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

To be a valid model, each entity type must have a primary key defined. Therefore, the primary key may be null while the model is being created, but will be present by the time the model is used with a DbContext.

FindProperty(String) 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.

GetAnnotations() GetAnnotations()

Gets all annotations on the current object.

(Inherited from IAnnotatable)
GetForeignKeys() GetForeignKeys()

Gets the foreign keys defined on this entity.

GetIndexes() GetIndexes()

Gets the indexes defined on this entity.

GetKeys() GetKeys()

Gets the primary and alternate keys for this entity.

GetProperties() GetProperties()

Gets the properties defined on this entity.

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

Extension Methods

Microsoft.EntityFrameworkCore.SqlServerMetadataExtensions.SqlServer() Microsoft.EntityFrameworkCore.SqlServerMetadataExtensions.SqlServer()
Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetDerivedTypes() Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetDerivedTypes()
Microsoft.EntityFrameworkCore.EntityTypeExtensions.RootType() Microsoft.EntityFrameworkCore.EntityTypeExtensions.RootType()
Microsoft.EntityFrameworkCore.EntityTypeExtensions.IsAssignableFrom(IEntityType) Microsoft.EntityFrameworkCore.EntityTypeExtensions.IsAssignableFrom(IEntityType)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.LeastDerivedType(IEntityType) Microsoft.EntityFrameworkCore.EntityTypeExtensions.LeastDerivedType(IEntityType)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindKey(IProperty) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindKey(IProperty)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindForeignKeys(IProperty) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindForeignKeys(IProperty)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindForeignKeys(System.Collections.Generic.IReadOnlyList<IProperty>) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindForeignKeys(System.Collections.Generic.IReadOnlyList(Of IProperty))
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindForeignKey(IProperty, IKey, IEntityType) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindForeignKey(IProperty, IKey, IEntityType)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetReferencingForeignKeys() Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetReferencingForeignKeys()
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindNavigation(System.Reflection.PropertyInfo) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindNavigation(System.Reflection.PropertyInfo)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindNavigation(System.String) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindNavigation(System.String)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetNavigations() Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetNavigations()
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindProperty(System.Reflection.PropertyInfo) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindProperty(System.Reflection.PropertyInfo)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindIndex(IProperty) Microsoft.EntityFrameworkCore.EntityTypeExtensions.FindIndex(IProperty)
Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetChangeTrackingStrategy() Microsoft.EntityFrameworkCore.EntityTypeExtensions.GetChangeTrackingStrategy()
Microsoft.EntityFrameworkCore.TypeBaseExtensions.GetPropertyAccessMode() Microsoft.EntityFrameworkCore.TypeBaseExtensions.GetPropertyAccessMode()
Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableExtensions.GetAnnotation(System.String) Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableExtensions.GetAnnotation(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.AnnotatableExtensions.AnnotationsToDebugString(System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.AnnotatableExtensions.AnnotationsToDebugString(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.TypeBaseExtensions.DisplayName() Microsoft.EntityFrameworkCore.Metadata.Internal.TypeBaseExtensions.DisplayName()
Microsoft.EntityFrameworkCore.Metadata.Internal.TypeBaseExtensions.HasClrType() Microsoft.EntityFrameworkCore.Metadata.Internal.TypeBaseExtensions.HasClrType()
Microsoft.EntityFrameworkCore.Metadata.Internal.TypeBaseExtensions.IsAbstract() Microsoft.EntityFrameworkCore.Metadata.Internal.TypeBaseExtensions.IsAbstract()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetAllBaseTypesInclusive() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetAllBaseTypesInclusive()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDirectlyDerivedTypes() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDirectlyDerivedTypes()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDerivedTypesInclusive() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDerivedTypesInclusive()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.UseEagerSnapshots() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.UseEagerSnapshots()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.StoreGeneratedCount() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.StoreGeneratedCount()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.RelationshipPropertyCount() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.RelationshipPropertyCount()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.OriginalValueCount() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.OriginalValueCount()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.ShadowPropertyCount() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.ShadowPropertyCount()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.NavigationCount() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.NavigationCount()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.PropertyCount() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.PropertyCount()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetCounts() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetCounts()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.CalculateCounts() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.CalculateCounts()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetRelationshipSnapshotFactory() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetRelationshipSnapshotFactory()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetOriginalValuesFactory() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetOriginalValuesFactory()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetShadowValuesFactory() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetShadowValuesFactory()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetEmptyShadowValuesFactory() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetEmptyShadowValuesFactory()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetConcreteTypesInHierarchy() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetConcreteTypesInHierarchy()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.IsSameHierarchy(IEntityType) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.IsSameHierarchy(IEntityType)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.FindDeclaredPrimaryKey() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.FindDeclaredPrimaryKey()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredKeys() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredKeys()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredForeignKeys() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredForeignKeys()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredNavigations() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredNavigations()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredReferencingForeignKeys() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredReferencingForeignKeys()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.FindDerivedNavigations(System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.FindDerivedNavigations(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredProperties() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredProperties()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.FindDerivedProperties(System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.FindDerivedProperties(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetPropertiesAndNavigations() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetPropertiesAndNavigations()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredIndexes() Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetDeclaredIndexes()
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.CheckChangeTrackingStrategy(ChangeTrackingStrategy) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.CheckChangeTrackingStrategy(ChangeTrackingStrategy)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetNotificationProperties(System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetNotificationProperties(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.ToDebugString(System.Boolean, System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.ToDebugString(System.Boolean, System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetProperty(System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.GetProperty(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.CheckPropertyBelongsToType(IProperty) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.CheckPropertyBelongsToType(IProperty)
Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.AsEntityType(System.String) Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.AsEntityType(System.String)
Microsoft.EntityFrameworkCore.Metadata.Internal.PropertyBaseExtensions.CalculateIndexes(IPropertyBase) Microsoft.EntityFrameworkCore.Metadata.Internal.PropertyBaseExtensions.CalculateIndexes(IPropertyBase)
Microsoft.EntityFrameworkCore.SqliteMetadataExtensions.Sqlite() Microsoft.EntityFrameworkCore.SqliteMetadataExtensions.Sqlite()
Microsoft.EntityFrameworkCore.Relational.Tests.TestRelationalMetadataExtensions.TestProvider() Microsoft.EntityFrameworkCore.Relational.Tests.TestRelationalMetadataExtensions.TestProvider()
Microsoft.EntityFrameworkCore.RelationalMetadataExtensions.Relational() Microsoft.EntityFrameworkCore.RelationalMetadataExtensions.Relational()