IConventionEntityType.AddKey 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
AddKey(IConventionProperty, Boolean) |
Adds a new alternate key to this entity type. |
AddKey(IReadOnlyList<IConventionProperty>, Boolean) |
Adds a new alternate key to this entity type. |
AddKey(IConventionProperty, Boolean)
Adds a new alternate key to this entity type.
public virtual Microsoft.EntityFrameworkCore.Metadata.IConventionKey? AddKey (Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, bool fromDataAnnotation = false);
abstract member AddKey : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
override this.AddKey : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
Public Overridable Function AddKey (property As IConventionProperty, Optional fromDataAnnotation As Boolean = false) As IConventionKey
Parameters
- property
- IConventionProperty
The property to use as an alternate key.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The newly created key.
Applies to
AddKey(IReadOnlyList<IConventionProperty>, Boolean)
Adds a new alternate key to this entity type.
public Microsoft.EntityFrameworkCore.Metadata.IConventionKey AddKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.IConventionKey? AddKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
abstract member AddKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
Public Function AddKey (properties As IReadOnlyList(Of IConventionProperty), Optional fromDataAnnotation As Boolean = false) As IConventionKey
Parameters
- properties
- IReadOnlyList<IConventionProperty>
The properties that make up the alternate key.
- 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.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for