2.1.5 Entity Key

A Key element describes which Property elements form a key that can uniquely identify instances of an EntityType. Any set of non-nullable, immutable, scalar type declared properties can serve as the key.

The following is an example of the Key element.

     <Key>
       <PropertyRef Name="CustomerId" />
     </Key>

The following rules apply to the Key element:

  • Key can contain any number of AnnotationAttribute attributes. The full names of the AnnotationAttribute attributes cannot collide.

  • Key MUST have one or more PropertyRef child elements.

  • Each PropertyRef child element names a Property of a type that is equality comparable.

  • In CSDL 2.0 and CSDL 3.0, Key can contain any number of AnnotationElement elements.

Graphic representation in table format of the rules that apply to the Key element of EntityType.

All child elements are to appear in the order indicated.