Language

PrimaryKeyAttribute クラス

定義

この 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
継承
PrimaryKeyAttribute
属性

注釈

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

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

コンストラクター

Name 説明
PrimaryKeyAttribute(String, String[])

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

プロパティ

Name 説明
PropertyNames

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

適用対象