次の方法で共有


Default 属性 (EntityType CSDL)

エンティティ データ モデル (EDM) では、型のインスタンス作成時にプロパティに割り当てられる値が、Property 要素の Default 属性によって指定されます。

次の Department エンティティの定義には、4 つの Property 要素が含まれています。各プロパティには、割り当てられたデータ型を使用する Type 属性があります。たとえば、GroupName プロパティには、"New Hire" という Default が割り当てられています。

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