ConventionTypeConfiguration.HasKey Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
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. |
HasKey(IEnumerable<PropertyInfo>)
Configures the primary key property(s) for this entity type.
public System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration HasKey (System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> keyProperties);
member this.HasKey : seq<System.Reflection.PropertyInfo> -> System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration
Public Function HasKey (keyProperties As IEnumerable(Of PropertyInfo)) As ConventionTypeConfiguration
Parameters
- keyProperties
- IEnumerable<PropertyInfo>
The properties to be used as the primary key.
Returns
The same ConventionTypeConfiguration instance so that multiple calls can be chained.
Remarks
Calling this will have no effect once it has been configured or if any property does not exist.
Applies to
HasKey(IEnumerable<String>)
Configures the primary key property(s) for this entity type.
public System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration HasKey (System.Collections.Generic.IEnumerable<string> propertyNames);
member this.HasKey : seq<string> -> System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration
Public Function HasKey (propertyNames As IEnumerable(Of String)) As ConventionTypeConfiguration
Parameters
- propertyNames
- IEnumerable<String>
The names of the properties to be used as the primary key.
Returns
The same ConventionTypeConfiguration instance so that multiple calls can be chained.
Applies to
HasKey(PropertyInfo)
Configures the primary key property for this entity type.
public System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration HasKey (System.Reflection.PropertyInfo propertyInfo);
member this.HasKey : System.Reflection.PropertyInfo -> System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration
Parameters
- propertyInfo
- PropertyInfo
The property to be used as the primary key.
Returns
The same ConventionTypeConfiguration instance so that multiple calls can be chained.
Applies to
HasKey(String)
Configures the primary key property for this entity type.
public System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration HasKey (string propertyName);
member this.HasKey : string -> System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration
Public Function HasKey (propertyName As String) As ConventionTypeConfiguration
Parameters
- propertyName
- String
The name of the property to be used as the primary key.
Returns
The same ConventionTypeConfiguration instance so that multiple calls can be chained.
Applies to
Entity Framework