Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Configures the key property(s) for this entity type.
Namespace: System.Web.Http.OData.Builder
Assembly: System.Web.Http.OData (in System.Web.Http.OData.dll)
Syntax
public EntityTypeConfiguration<TEntityType> HasKey<TKey>(
Expression<Func<TEntityType, TKey>> keyDefinitionExpression
)
public:
generic<typename TKey>
EntityTypeConfiguration<TEntityType>^ HasKey(
Expression<Func<TEntityType, TKey>^>^ keyDefinitionExpression
)
member HasKey<'TKey> :
keyDefinitionExpression:Expression<Func<'TEntityType, 'TKey>> -> EntityTypeConfiguration<'TEntityType>
Public Function HasKey(Of TKey) (
keyDefinitionExpression As Expression(Of Func(Of TEntityType, TKey))
) As EntityTypeConfiguration(Of TEntityType)
Parameters
keyDefinitionExpression
Type: System.Linq.Expressions.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.
Return Value
Type: System.Web.Http.OData.Builder.EntityTypeConfiguration<TEntityType>
Returns itself so that multiple calls can be chained.
Type Parameters
- TKey
The type of key.
See Also
EntityTypeConfiguration<TEntityType> Class
System.Web.Http.OData.Builder Namespace
Return to top