This documentation is archived and is not being maintained.

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):

No attributes are applicable to the Key element.


The following example shows an EntityType element with a key that references one property:

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

See Also