ConventionTypeConfiguration.HasKey Method
Configures the primary key property(s) for this entity type.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | HasKey(IEnumerable<PropertyInfo>) | Configures the primary key property(s) for this entity type. |
![]() | HasKey(IEnumerable<String>) | Configures the primary key property(s) for this entity type. |
![]() | HasKey(PropertyInfo) | Configures the primary key property for this entity type. |
![]() | HasKey(String) | Configures the primary key property for this entity type. |
ConventionTypeConfiguration.HasKey Method (IEnumerable<PropertyInfo>)
Configures the primary key property(s) for this entity type.
Parameters
- keyProperties
-
Type:
System.Collections.Generic.IEnumerable<PropertyInfo>
The properties to be used as the primary key.
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfigurationThe same ConventionTypeConfiguration instance so that multiple calls can be chained.
Calling this will have no effect once it has been configured or if any property does not exist.
ConventionTypeConfiguration.HasKey Method (IEnumerable<String>)
Configures the primary key property(s) for this entity type.
Parameters
- propertyNames
-
Type:
System.Collections.Generic.IEnumerable<String>
The names of the properties to be used as the primary key.
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfigurationThe same ConventionTypeConfiguration instance so that multiple calls can be chained.
ConventionTypeConfiguration.HasKey Method (PropertyInfo)
Configures the primary key property for this entity type.
Parameters
- propertyInfo
-
Type:
System.Reflection.PropertyInfo
The property to be used as the primary key.
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfigurationThe same ConventionTypeConfiguration instance so that multiple calls can be chained.
ConventionTypeConfiguration.HasKey Method (String)
Configures the primary key property for this entity type.
Parameters
- propertyName
-
Type:
System.String
The name of the property to be used as the primary key.
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfigurationThe same ConventionTypeConfiguration instance so that multiple calls can be chained.