IConventionEntityType.SetPrimaryKey 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
SetPrimaryKey(IReadOnlyList<IConventionProperty>, Boolean) |
Sets the primary key for this entity type. |
SetPrimaryKey(IConventionProperty, Boolean) |
Sets the primary key for this entity type. |
SetPrimaryKey(IReadOnlyList<IConventionProperty>, Boolean)
Sets the primary key for this entity type.
public Microsoft.EntityFrameworkCore.Metadata.IConventionKey SetPrimaryKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.IConventionKey? SetPrimaryKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty>? properties, bool fromDataAnnotation = false);
abstract member SetPrimaryKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
Public Function SetPrimaryKey (properties As IReadOnlyList(Of IConventionProperty), Optional fromDataAnnotation As Boolean = false) As IConventionKey
Parameters
- properties
- IReadOnlyList<IConventionProperty>
The properties that make up the primary key.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The newly created key.
Applies to
SetPrimaryKey(IConventionProperty, Boolean)
Sets the primary key for this entity type.
public virtual Microsoft.EntityFrameworkCore.Metadata.IConventionKey SetPrimaryKey (Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, bool fromDataAnnotation = false);
public virtual Microsoft.EntityFrameworkCore.Metadata.IConventionKey? SetPrimaryKey (Microsoft.EntityFrameworkCore.Metadata.IConventionProperty? property, bool fromDataAnnotation = false);
abstract member SetPrimaryKey : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
override this.SetPrimaryKey : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
Public Overridable Function SetPrimaryKey (property As IConventionProperty, Optional fromDataAnnotation As Boolean = false) As IConventionKey
Parameters
- property
- IConventionProperty
The primary key property.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The newly created key.
Applies to
Entity Framework
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: Under hela 2024 kommer vi att fasa ut GitHub-problem som feedbackmekanism för innehåll och ersätta det med ett nytt feedbacksystem. Mer information finns i:Skicka och visa feedback för