EntitySet Element (EntityContainer SSDL)

The EntitySet element in store schema definition language (SSDL) specifies a table in the database that contains data for applications built on the Entity Data Model (EDM).

The object model requires both programmable classes and storage structures to contain data for applications built on the model. An EntitySetMapping in mapping specification language (MSL) connects the EntitySet defined in conceptual schema definition language (CSDL) to the EntitySet in SSDL describing the storage structures.

The following SSDL syntax shows the declaration of an EntitySet named Department that is part of the AdventureWorksHRTarget EntityContainer. The declaration of the EntityType is included after the EntityContainer and EntitySet.

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

Two attributes on the EntitySet element in SSDL, Table and Schema, are usually left as set by default values. The user can override the default for the Table attribute, which is the EntitySet name or the default for the Schema attribute, which is the EntityContainer name.

See Also

Concepts

EntitySet Element (EntityContainer CSDL)
EntitySetMapping Element (MSL)
AdventureWorks Complete Model (EDM)