Share via


Atributo Key (CSDL EntityType)

En Entity Data Model (EDM), el atributo Key de un elemento EntityType especifica la propiedad que se usará para identificar las instancias del tipo en todas las operaciones.

La declaración siguiente de la entidad Department muestra la asignación de Key: Key="Department ID".

La definición de Property en este caso es un entero de dieciséis bits. La propiedad Key no puede ser NULL, según se indica en la restricción Nullable="false" de la asignación.

  <EntityType Name="Department" 
   <Key>
        <PropertyRef Name="DepartmentID">
    </Key>
    <Property Name="DepartmentID" Type="Int16" Nullable="false" />
    <Property Name="Name" Type="String" Nullable="false" />
    <Property Name="GroupName" Type="String" Nullable="false" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

Vea también

Conceptos

Atributo Key (SSDL EntityType)