Export (0) Print
Expand All

EntityTypeConfiguration<TEntityType> Class

Entity Framework 5.0

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

System.Object
  System.Data.Entity.ModelConfiguration.Configuration.StructuralTypeConfiguration<TEntityType>
    System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<TEntityType>

Namespace:  System.Data.Entity.ModelConfiguration
Assembly:  EntityFramework (in EntityFramework.dll)

public class EntityTypeConfiguration<TEntityType> : StructuralTypeConfiguration<TEntityType>
where TEntityType : class

Type Parameters

TEntityType

Represents the entity type.

The EntityTypeConfiguration<TEntityType> type exposes the following members.

  NameDescription
Public methodEntityTypeConfiguration<TEntityType>Initializes a new instance of EntityTypeConfiguration<TEntityType>.
Top

  NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object. This method is hidden from IntelliSense. (Overrides StructuralTypeConfiguration<TStructuralType>.Equals(Object).)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. This method is hidden from IntelliSense. (Overrides StructuralTypeConfiguration<TStructuralType>.GetHashCode().)
Public methodGetTypeGets the type of the current instance. This method is hidden from IntelliSense.
Public methodHasEntitySetName 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.
Public methodHasKey<TKey> Configures the primary key property(s) for this entity type.
Public methodHasMany<TTargetEntity> Configures a many relationship from this entity type.
Public methodHasOptional<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.
Public methodHasRequired<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.
Public methodIgnore<TProperty> Excludes a property from the model so that it will not be mapped to the database. (Inherited from StructuralTypeConfiguration<TStructuralType>.)
Public methodMap(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 by using the specific overload of this method that configures a derived type or by using an EntityTypeConfiguration<TEntityType> for the derived type. The properties of an entity can be split between multiple tables using multiple calls to this method. Calls are additive, and subsequent calls will not override configuration already performed by previous calls to this method.
Public methodMap<TDerived>(Action<EntityMappingConfiguration<TDerived>>) Allows advanced configuration related to how a derived entity type is mapped to the database schema. Calls to this method are additive, and subsequent calls will not override configuration already performed by previous calls to this method.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodProperty<T>(Expression<Func<TStructuralType, T>>) Configures a struct property that is defined on this type. (Inherited from StructuralTypeConfiguration<TStructuralType>.)
Public methodToStringReturns a string that represents the current object. This method is hidden from IntelliSense. (Overrides StructuralTypeConfiguration<TStructuralType>.ToString().)
Public methodToTable(String)Configures the table name that this entity type is mapped to.
Public methodToTable(String, String) Configures the table name that this entity type is mapped to.
Top

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft