Compartir a través de


Property Element (EntityType CSDL)

In the Entity Data Model (EDM), properties are the elements of EntityType declarations that contain most of the information that is used by applications. A Property declaration includes Type and Default attributes. Sometimes the data type assigns the Nullable constraint on a property.

The properties of the following Employee declaration contain many details that are assigned after the Employee entity is created by application code. Properties that include the constraint Nullable="false" on the Type must be assigned a value or the entity will throw an exception when it is saved to storage. The Nullable constraint is optional on most properties and defaults to true. The Key attribute must include the Nullable="false" assignment.

  <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" />
    <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>

See Also

Concepts

Property Element (EntityType SSDL)