IConventionEntityTypeBuilder.HasKey Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Crée une autre clé dans le modèle pour ce type d’entité s’il n’en existe pas déjà sur les propriétés spécifiées.
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder HasKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder? HasKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
abstract member HasKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder
Public Function HasKey (properties As IReadOnlyList(Of IConventionProperty), Optional fromDataAnnotation As Boolean = false) As IConventionKeyBuilder
Paramètres
- properties
- IReadOnlyList<IConventionProperty>
Propriétés qui composent la clé.
- fromDataAnnotation
- Boolean
Indique si la configuration a été spécifiée à l’aide d’une annotation de données.
Retours
Objet qui peut être utilisé pour configurer la clé si elle existe sur le type d’entité, null
sinon.
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour