共用方式為


Name Attribute (EntityContainer CSDL)

The Name attribute of an EntityContainer element specifies the name of a class in an object model built on the Entity Data Model (EDM). The Name assigned to an EntityContainer in conceptual schema definition language (CSDL) is used in the mapping specification to map a programmable class to storage structures. For more information about mapping the conceptual schema to storage metadata, see EntityContainerMapping Element (MSL).

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 EntityContainer to storage. In the mapping file, the name of the EntityContainer does not include the schema namespace name.

In the code example that follows, the Name is assigned in the opening element:

<EntityContainer Name="HumanResources">.

The following schema example shows an EntityContainer in the Adventure Works CSDL schema example.

  <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="Employee_Employee_ManagerID"
                     Association="Self.Employee_Employee_ManagerID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="EmployeeManager" EntitySet="Employee" />
    </AssociationSet>
    <AssociationSet Name="JobCandidate_Employee_EmployeeID"
                 Association="Self.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 shown in this example, see EntitySet Element (EntityContainer CSDL) and AssociationSet Element (EntityContainer CSDL).

See Also

Concepts

EntityContainer Element (SSDL)
EntityContainerMapping Element (MSL)
EntitySetMapping Element (MSL)
Entity Containers (EDM)
AdventureWorks Complete Model (EDM)