Freigeben über


Property-Element (EntityType CSDL)

Im Entitätsdatenmodell (EDM) sind Eigenschaften die Elemente von EntityType-Deklarationen, die den größten Teil der von Anwendungen verwendeten Informationen enthalten. Eine Property-Deklaration enthält ein Type-Attribut und ein Default-Attribut. Gelegentlich weist der Datentyp einer Eigenschaft die Einschränkung zu, NULL-Werte zuzulassen.

Die Eigenschaften der folgenden Employee-Deklaration enthalten viele Details, die nach der Erstellung der Employee-Entität durch Anwendungscode zugewiesen werden. Eigenschaften, die die Einschränkung Nullable="false" für den Type enthalten, muss ein Wert zugewiesen werden. Andernfalls löst die Entität beim Speichern eine Ausnahme aus. Die Nullable-Einschränkung ist für die meisten Eigenschaften optional. Sie ist standardmäßig auf true festgelegt. Das Key-Attribut muss die Nullable="false"-Zuweisung enthalten.

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

Siehe auch

Konzepte

Property-Element (EntityType SSDL)