PrimaryKeyAttribute クラス

定義

この CLR 型にマップされるエンティティ型の主キーを指定します。

[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class PrimaryKeyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type PrimaryKeyAttribute = class
    inherit Attribute
Public NotInheritable Class PrimaryKeyAttribute
Inherits Attribute
継承
PrimaryKeyAttribute
属性

注釈

この属性は、1 つのプロパティで構成されるキーと、複数のプロパティで構成される複合キーの両方に使用できます。 KeyAttribute は、代わりに単一プロパティ キーに使用できます。その場合、動作は同じです。 両方の属性を使用する場合は、この属性が優先されます。

詳細と例については、「 エンティティ型とリレーションシップのモデル 化」を参照してください。

コンストラクター

PrimaryKeyAttribute(String, String[])

PrimaryKeyAttribute クラスの新しいインスタンスを初期化します。

プロパティ

PropertyNames

主キーを構成するプロパティを順番に指定します。

適用対象