共用方式為


Default 屬性 (EntityType CSDL)

在 實體資料模型 (EDM) 中,Property 項目的 Default 屬性 (Attribute) 會指定當建立此型別的執行個體時,指派給此屬性 (Property) 的值。

下列 Department 實體定義包含四個 Property 項目。每一個屬性 (Property) 都有一個使用指派之資料型別的 Type 屬性 (Attribute)。例如,GroupName 屬性包含 Default 指派 "New Hire"。

  <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" Default="New Hire" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

另請參閱

概念

Default 屬性 (EntityType SSDL)