Share via


EntitySet 項目 (EntityContainer SSDL)

存放結構定義語言 (SSDL) 內的 EntitySet 項目會指定資料庫中的資料表,其中包含以 實體資料模型 (EDM) 建置之應用程式的資料。

此物件模型同時需要可程式化類別和儲存結構,以容納模型上所建置之應用程式的資料。對應規格語言 (MSL) 中的 EntitySetMapping 會將概念結構定義語言 (CSDL) 中定義的 EntitySet 連接到描述儲存結構之 SSDL 中的 EntitySet

下列 SSDL 語法顯示屬於 AdventureWorksHRTargetEntityContainer 一部分之名為 DepartmentEntitySet 宣告。EntityType 的宣告會包含在 EntityContainerEntitySet 的後面。

  <EntityContainer Name="HumanResources">
    <EntitySet Name="Department"
           EntityType="AdventureWorksHRTarget.Department" />
    <!-- Other EntitySet and AssociationSet tags omitted. -->

  </EntityContainer>


  <EntityType Name="Department" >
    <Key>
        <PropertyReference Name="DepartmentID">
    </Key>
    <Property Name="DepartmentID" Type="smallint" Nullable="false"
                                    StoreGeneratedPattern="Identity" />
    <Property Name="Name" Type="nvarchar" Nullable="false"
                                                 MaxLength="50" />
    <Property Name="GroupName" Type="nvarchar" Nullable="false"
                                               MaxLength="50" />
    <Property Name="ModifiedDate" Type="datetime" Nullable="false" />
  </EntityType>

在 SSDL 中,EntitySet 項目的兩個屬性 TableSchema 的設定通常會維持為預設值。使用者可以覆寫 Table 屬性的預設值 (即 EntitySet 名稱) 或 Schema 屬性的預設值 (即 EntityContainer 名稱)。

另請參閱

概念

EntitySet 項目 (EntityContainer CSDL)
EntitySetMapping 項目 (MSL)
AdventureWorks 完整模型 (EDM)