Jaa


EntityTypeConfiguration<TEntityType>.HasKey<TKey> Method

Definition

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

public Microsoft.AspNet.OData.Builder.EntityTypeConfiguration<TEntityType> HasKey<TKey> (System.Linq.Expressions.Expression<Func<TEntityType,TKey>> keyDefinitionExpression);
member this.HasKey : System.Linq.Expressions.Expression<Func<'EntityType, 'Key>> -> Microsoft.AspNet.OData.Builder.EntityTypeConfiguration<'EntityType (requires 'EntityType : null)>
Public Function HasKey(Of TKey) (keyDefinitionExpression As Expression(Of Func(Of TEntityType, TKey))) As EntityTypeConfiguration(Of TEntityType)

Type Parameters

TKey

The type of key.

Parameters

keyDefinitionExpression
Expression<Func<TEntityType,TKey>>

A lambda expression representing the property to be used as the primary key. For example, in C# t => t.Id and in Visual Basic .Net Function(t) t.Id.

Returns

Returns itself so that multiple calls can be chained.

Applies to