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)