Freigeben über


Name-Attribut (EntityContainer CSDL)

Das Name-Attribut eines EntityContainer-Elements gibt den Namen einer Klasse in einem auf dem Entitätsdatenmodell (EDM) aufbauenden Objektmodell an. Der einem EntityContainer in CSDL zugewiesene Name wird in der Mappingspezifikation verwendet, um eine programmierbare Klasse Speicherstrukturen zuzuordnen. Weitere Informationen über das Mapping des konzeptionellen Schemas zu Speichermetadaten finden Sie unter EntityContainerMapping-Element (MSL).

In der XML-Hierarchie ist das EntityContainer-Element vom Schema-Element getrennt, obwohl der EntityContainer in einem Schema definiert ist. Dies ist beim Mapping des EntityContainer zu einem Speicher wichtig. In der Mappingdatei ist im Namen des EntityContainer der Name des Schemanamespace nicht enthalten.

Im folgenden Codebeispiel wird der Name im öffnenden Element zugewiesen:

<EntityContainer Name="HumanResources">.

Im folgenden Schemabeispiel wird ein EntityContainer im Adventure Works -CSDL-Schemabeispiel gezeigt.

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

Weitere Informationen über die in diesem Beispiel gezeigten Entitätenmengen und Zuordnungssätze finden Sie unter EntitySet-Element (EntityContainer CSDL) und AssociationSet-Element (EntityContainer CSDL).

Siehe auch

Konzepte

EntityContainer-Element (SSDL)
EntityContainerMapping-Element (MSL)
EntitySetMapping-Element (MSL)
Entitätencontainer (EDM)
Das vollständige AdventureWorks-Modell (EDM)