OwnedNavigationBuilder<TOwnerEntity,TDependentEntity>.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(String[]) |
Sets the properties that make up the primary key for this owned entity type. |
HasKey(Expression<Func<TDependentEntity,Object>>) |
Sets the properties that make up the primary key for this owned entity type. |
HasKey(String[])
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
Sets the properties that make up the primary key for this owned entity type.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TDependentEntity> HasKey (params string[] propertyNames);
override this.HasKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<'DependentEntity (requires 'DependentEntity : null)>
Public Overridable Function HasKey (ParamArray propertyNames As String()) As KeyBuilder(Of TDependentEntity)
Parameters
- propertyNames
- String[]
The names of the properties that make up the primary key.
Returns
An object that can be used to configure the primary key.
Applies to
HasKey(Expression<Func<TDependentEntity,Object>>)
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
- Source:
- OwnedNavigationBuilder%60.cs
Sets the properties that make up the primary key for this owned entity type.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder HasKey (System.Linq.Expressions.Expression<Func<TDependentEntity,object>> keyExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TDependentEntity> HasKey (System.Linq.Expressions.Expression<Func<TDependentEntity,object>> keyExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TDependentEntity> HasKey (System.Linq.Expressions.Expression<Func<TDependentEntity,object?>> keyExpression);
override this.HasKey : System.Linq.Expressions.Expression<Func<'DependentEntity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder
override this.HasKey : System.Linq.Expressions.Expression<Func<'DependentEntity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<'DependentEntity (requires 'DependentEntity : null)>
Public Overridable Function HasKey (keyExpression As Expression(Of Func(Of TDependentEntity, Object))) As KeyBuilder
Public Overridable Function HasKey (keyExpression As Expression(Of Func(Of TDependentEntity, Object))) As KeyBuilder(Of TDependentEntity)
Parameters
- keyExpression
- Expression<Func<TDependentEntity,Object>>
A lambda expression representing the primary key property(s) (blog => blog.Url
).
If the primary key is made up of multiple properties then specify an anonymous type including the
properties (post => new { post.Title, post.BlogId }
).
Returns
An object that can be used to configure the primary key.