Partager via


Élément Property (EntityType SSDL)

Dans le modèle EDM (Modèle de données d'entité), les propriétés sont les éléments des déclarations EntityType qui contiennent la plupart des informations utilisées par les applications. Un élément Property inclut Type et peut inclure la contrainte Nullability et/ou l'attribut Default.

Les propriétés de la déclaration Employee suivante contiennent des informations qui sont assignées une fois l'entité Employee créée par le code d'application. Une valeur doit être assignée aux propriétés qui incluent la contrainte Nullable="false" sur l'attribut Type ou l'entité lèvera une exception lorsqu'elle sera enregistrée sur le support de stockage. La contrainte Nullable est facultative sur la plupart des propriétés et a la valeur par défaut true. L'attribut Key doit inclure l'assignation Nullable="false".

  <EntityType Name="Employee">
    <Key>
        <PropertyRef Name="EmployeeID">
    </Key>
    <Property Name="EmployeeID" Type="Int32" Nullable="false" />
    <Property Name="NationalIDNumber" Type="String" Nullable="false" />
    <Property Name="ContactID" Type="Int32" Nullable="false" />
    <Property Name="LoginID" Type="String" Nullable="false" />
    <Property Name="Title" Type="String" Nullable="false"
 Default="NewHire" />
    <Property Name="BirthDate" Type="DateTime" Nullable="false" />
    <Property Name="MaritalStatus" Type="String" Nullable="false" />
    <Property Name="Gender" Type="String" Nullable="false" />
    <Property Name="HireDate" Type="DateTime" Nullable="false" />
    <Property Name="SalariedFlag" Type="Boolean" Nullable="false" />
    <Property Name="VacationHours" Type="Int16" Nullable="false" />
    <Property Name="SickLeaveHours" Type="Int16" Nullable="false" />
    <Property Name="CurrentFlag" Type="Boolean" Nullable="false" />
    <Property Name="rowguid" Type="Guid" Nullable="false" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

Voir aussi

Concepts

Élément Property (EntityType SSDL)