Key Element (SSDL)
The Key element in store schema definition language (SSDL) represents the primary key of a table in the underlying database. Key is a child element of an EntityType element, which represents a row in a table. The primary key is defined in the Key element by referencing one or more Property elements that are defined on the EntityType element.
The Key element can have the following child elements (in the order listed):
PropertyRef (one or more)
No attributes are applicable to the Key element.
Example
The following example shows an EntityType element with a key that references one property:
<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>
See Also
Concepts
Entity Framework Overview
SSDL Specification
Other Resources
CSDL, SSDL, and MSL Specifications
ADO.NET Entity Data Model Tools