Share via


EntityTypeConfiguration<TEntityType> Class

Definition

Allows configuration to be performed for an entity type in a model. An EntityTypeConfiguration can be obtained via the Entity method on DbModelBuilder or a custom type derived from EntityTypeConfiguration can be registered via the Configurations property on DbModelBuilder.

public class EntityTypeConfiguration<TEntityType> : System.Data.Entity.ModelConfiguration.Configuration.StructuralTypeConfiguration<TEntityType> where TEntityType : class
type EntityTypeConfiguration<'EntityType (requires 'EntityType : null)> = class
    inherit StructuralTypeConfiguration<'EntityType (requires 'EntityType : null)>
Public Class EntityTypeConfiguration(Of TEntityType)
Inherits StructuralTypeConfiguration(Of TEntityType)

Type Parameters

TEntityType

The entity type being configured.

Inheritance
EntityTypeConfiguration<TEntityType>

Constructors

EntityTypeConfiguration<TEntityType>()

Initializes a new instance of EntityTypeConfiguration

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

GetHashCode()

Serves as the default hash function.

GetType()

Gets the Type of the current instance.

HasEntitySetName(String)

Configures the entity set name to be used for this entity type. The entity set name can only be configured for the base type in each set.

HasIndex<TIndex>(Expression<Func<TEntityType,TIndex>>)

Configures index property(s) for this entity type.

HasKey<TKey>(Expression<Func<TEntityType,TKey>>)

Configures the primary key property(s) for this entity type.

HasKey<TKey>(Expression<Func<TEntityType,TKey>>, Action<PrimaryKeyIndexConfiguration>)

Configures the primary key property(s) for this entity type.

HasMany<TTargetEntity>(Expression<Func<TEntityType,ICollection<TTargetEntity>>>)

Configures a many relationship from this entity type.

HasOptional<TTargetEntity>(Expression<Func<TEntityType,TTargetEntity>>)

Configures an optional relationship from this entity type. Instances of the entity type will be able to be saved to the database without this relationship being specified. The foreign key in the database will be nullable.

HasRequired<TTargetEntity>(Expression<Func<TEntityType,TTargetEntity>>)

Configures a required relationship from this entity type. Instances of the entity type will not be able to be saved to the database unless this relationship is specified. The foreign key in the database will be non-nullable.

HasTableAnnotation(String, Object)

Sets an annotation in the model for the table to which this entity is mapped. The annotation value can later be used when processing the table such as when creating migrations.

Ignore<TProperty>(Expression<Func<TEntityType,TProperty>>)

Excludes a property from the model so that it will not be mapped to the database.

Ignore<TProperty>(Expression<Func<TStructuralType,TProperty>>)

Excludes a property from the model so that it will not be mapped to the database.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Map(Action<EntityMappingConfiguration<TEntityType>>)

Allows advanced configuration related to how this entity type is mapped to the database schema. By default, any configuration will also apply to any type derived from this entity type. Derived types can be configured via the overload of Map that configures a derived type or by using an EntityTypeConfiguration for the derived type. The properties of an entity can be split between multiple tables using multiple Map calls. Calls to Map are additive, subsequent calls will not override configuration already preformed via Map.

Map<TDerived>(Action<EntityMappingConfiguration<TDerived>>)

Allows advanced configuration related to how a derived entity type is mapped to the database schema. Calls to Map are additive, subsequent calls will not override configuration already preformed via Map.

MapToStoredProcedures()

Configures this type to use stored procedures for insert, update and delete. The default conventions for procedure and parameter names will be used.

MapToStoredProcedures(Action<ModificationStoredProceduresConfiguration<TEntityType>>)

Configures this type to use stored procedures for insert, update and delete.

Property(Expression<Func<TStructuralType,Byte[]>>)

Configures a System.byte[] property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,DateTime>>)

Configures a DateTime property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,DateTimeOffset>>)

Configures a DateTimeOffset property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,DbGeography>>)

Configures a DbGeography property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,DbGeography>>)

Configures a DbGeography property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,DbGeometry>>)

Configures a DbGeometry property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,DbGeometry>>)

Configures a DbGeometry property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,Decimal>>)

Configures a System.decimal property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,Nullable<DateTime>>>)

Configures a System.DateTime? property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,Nullable<DateTimeOffset>>>)

Configures a System.DateTimeOffset? property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,Nullable<Decimal>>>)

Configures a System.decimal? property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,Nullable<TimeSpan>>>)

Configures a System.TimeSpan? property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,String>>)

Configures a System.string property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property(Expression<Func<TStructuralType,TimeSpan>>)

Configures a TimeSpan property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property<T>(Expression<Func<TStructuralType,Nullable<T>>>)

Configures a System.struct? property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
Property<T>(Expression<Func<TStructuralType,T>>)

Configures a System.struct property that is defined on this type.

(Inherited from StructuralTypeConfiguration<TStructuralType>)
ToString()

Returns a string that represents the current object.

ToTable(String)

Configures the table name that this entity type is mapped to.

ToTable(String, String)

Configures the table name that this entity type is mapped to.

Applies to