ConventionTypeConfiguration.HasKey Method

 

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

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

NameDescription
System_CAPS_pubmethodHasKey(IEnumerable<PropertyInfo>)

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

System_CAPS_pubmethodHasKey(IEnumerable<String>)

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

System_CAPS_pubmethodHasKey(PropertyInfo)

Configures the primary key property for this entity type.

System_CAPS_pubmethodHasKey(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.

public ConventionTypeConfiguration HasKey(
	IEnumerable<PropertyInfo> keyProperties
)

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

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

public ConventionTypeConfiguration HasKey(
	IEnumerable<string> propertyNames
)

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

The same ConventionTypeConfiguration instance so that multiple calls can be chained.


ConventionTypeConfiguration.HasKey Method (PropertyInfo)

Configures the primary key property for this entity type.

public ConventionTypeConfiguration HasKey(
	PropertyInfo propertyInfo
)

Parameters

propertyInfo
Type: System.Reflection.PropertyInfo

The property to be used as the primary key.

Return Value

Type: System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration

The same ConventionTypeConfiguration instance so that multiple calls can be chained.


ConventionTypeConfiguration.HasKey Method (String)

Configures the primary key property for this entity type.

public ConventionTypeConfiguration HasKey(
	string propertyName
)

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

The same ConventionTypeConfiguration instance so that multiple calls can be chained.