Jazyk

PrimaryKeyAttribute Třída

Definice

Určuje primární klíč pro typ entity namapovaný na tento typ CLR.

[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Runtime.CompilerServices.Nullable(0)]
public sealed class PrimaryKeyAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class PrimaryKeyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type PrimaryKeyAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type PrimaryKeyAttribute = class
    inherit Attribute
Public NotInheritable Class PrimaryKeyAttribute
Inherits Attribute
Dědičnost
PrimaryKeyAttribute
Atributy

Poznámky

Tento atribut lze použít pro oba klíče tvořené jednou vlastností a pro složené klíče složené z více vlastností. KeyAttribute lze místo toho použít pro klíče s jednou vlastností, v takovém případě je chování identické. Pokud se použijí oba atributy, má tento atribut přednost.

Další informace a příklady najdete v tématu Modelování typů entit a relací .

Konstruktory

Název Description
PrimaryKeyAttribute(String, String[])

Inicializuje novou instanci PrimaryKeyAttribute třídy.

Vlastnosti

Název Description
PropertyNames

Vlastnosti, které představují primární klíč v pořadí.

Platí pro