Partager via


Role Attribute (Association SSDL)

In the Entity Data Model (EDM), the Role attribute of an End element specifies the entities related by the association and their functions. The association in the example in this topic connects Employee entities based on the manager/employee relationship. Both ends of the association are of the same type, as indicated by the assignment Type="AdventureWorks.Store.Employee".

The Role attribute distinguishes between the employee being managed and the manager. The Multiplicity attribute specifies that an Employee who is a manager can participate in zero or more instances of this association but an Employee1 can have only one manager and can participate in only one association of this type. This multiplicity designation corresponds to the relationship contained by the foreign key in the Employee table that can contain only one ManagerID.

  <Association Name="FK_Employee_Employee_ManagerID">
    <End Role="Employee" Type="Adventureworks.Store.Employee" Multiplicity="0..1" />
    <End Role="Employee1" Type="Adventureworks.Store.Employee" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Employee">
        <PropertyRef Name="EmployeeID" />
      </Principal>
      <Dependent Role="Employee1">
        <PropertyRef Name="ManagerID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

See Also

Concepts

Association Element (SSDL)
Role Attribute (Association SSDL)
AdventureWorks Complete Model (EDM)