Condividi tramite


EntityContainer Element (SSDL)

The EntityContainer defined in store schema definition language (SSDL) is metadata that describes the container that will persist data for applications built on the object model being defined by using the Entity Data Model (EDM). The EntityContainer is usually a database in a relational database management system (RDMS) such as SQL Server.

The namespace name of the SSDL schema, and the EntityContainer elements that it contains, are mapped to the corresponding namespace name of the conceptual schema definition language (CSDL) schema, and the EntityContainer elements that the namespace contains. In the XML hierarchy, the EntityContainer element is separate from the Schema element even though the EntityContainer is defined in a schema. This is important in mapping the entity container to storage. In the mapping file, the fully qualified name of the EntityContainer does not include the schema namespace name.

For more information about mapping the EntityContainer see EntityContainerMapping Element (MSL).

SSDL syntax is metadata defining the storage model used by an application built on the EDM. The EntityContainer declared in the following example is a database object. Each of the entity sets it contains represents a table in the Human Resources partition of Adventure Works database. The following syntax contains entity sets for employees, departments, employee addresses, employee histories and so forth. The HumanResources EntityContainer is defined as part of the AdventureWorksHRTarget namespace. Every occurrence of the alias Self will be expanded to this namespace name during the build process.

  <EntityContainer Name="HumanResources">
    <EntitySet Name="Department" EntityType="Self.Department" />
    <EntitySet Name="Employee" EntityType="Self.Employee" />
    <EntitySet Name="EmployeeAddress" EntityType="Self.EmployeeAddress" />
    <EntitySet Name="EmployeeDepartmentHistory"
                    EntityType="Self.EmployeeDepartmentHistory" />
    <EntitySet Name="EmployeePayHistory"
                              EntityType="Self.EmployeePayHistory" />
    <EntitySet Name="JobCandidate" EntityType="Self.JobCandidate" />
    <EntitySet Name="Shift" EntityType="Self.Shift" />
    <AssociationSet Name="FK_Employee_Employee_ManagerID"
        Association="Self.FK_Employee_Employee_ManagerID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="Employee1" EntitySet="Employee" />
    </AssociationSet>
    <AssociationSet Name="JobCandidate_Employee_EmployeeID"
             Association="Self.FK_JobCandidate_Employee_EmployeeID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="JobCandidate" EntitySet="JobCandidate" />
    </AssociationSet>
  </EntityContainer>

For more information about the entity sets and association sets defined in this EntityContainer, see the following topics in this section:

Name Attribute (EntityContainer SSDL)

EntitySet Element (EntityContainer SSDL)

AssociationSet Element (EntityContainer SSDL)

See Also

Concepts

Entity Sets (EDM)
Association Sets (EDM)
EntityContainerMapping Element (MSL)
AdventureWorks Complete Model (EDM)