Default 属性 (EntityType SSDL)

在 实体数据模型 (EDM) 中,Property 定义的 Default 属性指定在创建类型的实例时为属性分配的值。

以下 Department 实体的定义包括 4 个 Property 元素。每个属性 (Property) 都有一个使用已分配数据类型的 Type 属性 (Attribute)。例如,GroupName 属性 (Property) 包括 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" MaxLength="50" />
    <Property Name="GroupName" Type="String" Nullable="false"
                               Default="New Hire" MaxLength="50" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

另请参见

概念

Default 属性 (EntityType CSDL)