EntitySet Element (EntityContainer CSDL)

In the Entity Data Model (EDM), the EntitySet element in conceptual schema definition language (CSDL) specifies a type in the class that will be built from the conceptual schema.

The object model being defined 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 CSDL to the EntitySet that describes the storage structures in store schema definition language (SSDL).

The following CSDL syntax shows the declaration of an EntitySet named Department. This EntitySet is part of an EntityContainer named HumanResources. This EntityContainer is defined in the AdventureWorksHRModel schema, but it is an independent element. The EntitySet element assigns a Name and identifies the EntityType of the entities included in this set designation.

When the object model is built from this schema, entities of the Department type can be instantiated in application code. For completeness, the declaration of the EntityType is included after the EntityContainer and EntitySet.

  <EntityContainer Name="HumanResources">
    <EntitySet Name="Department"
                 EntityType="AdventureWorksHRModel.Department" />

    <!-- Other EntitySet and AssociationSet tags omitted. -->
  </EntityContainer>


  <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" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

See Also

Concepts

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