Share via


Key 要素 (SSDL)

ストア スキーマ定義言語 (SSDL) の Key 要素は、基になるデータベースのテーブルの主キーを表します。 KeyEntityType 要素の子要素です。これはテーブル内の行を表します。 主キーは、EntityType 要素で定義される 1 つ以上の Property 要素を参照することにより、Key 要素内で定義されます。

The Key element can have the following child elements (in the order listed):

No attributes are applicable to the Key element.

次の例では、1 つのプロパティを参照するキーを持つ EntityType 要素を示しています。

<EntityType Name="Customers">
  <Documentation>
    <Summary>Summary here.</Summary>
    <LongDescription>Long description here.</LongDescription>
  </Documentation>
  <Key>
    <PropertyRef Name="CustomerId" />
  </Key>
  <Property Name="CustomerId" Type="int" Nullable="false" />
  <Property Name="Name" Type="nvarchar(max)" Nullable="false" />
</EntityType>

参照

概念

エンティティ フレームワークの概要
SSDL 仕様

その他のリソース

CSDL、SSDL、および MSL 仕様
ADO.NET Entity Data Model Tools