Condividi tramite


Multiplicity Attribute (Association SSDL)

In the Entity Data Model (EDM), the Multiplicity attribute of the End element of an association specifies the number of entities of each type that can be related by an association.

The association in the following example connects Employee entities based on the employee/manager relationship. Both ends of the association are of the same type, as indicated by the assignment Type="AdventureWorks.Store.Employee".

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>

This example illustrates the one-to-many multiplicity of an association. For a complete example that uses a many-to-many association, see Annotation and Research Collaboration Tool (EDM Sample Application)

See Also

Concepts

AssociationSet Element (EntityContainer SSDL)
Multiplicity Attribute (Association SSDL)
AssociationSetMapping Element (MSL)
Type Attribute (Association SSDL)
AdventureWorks Complete Model (EDM)
ReferentialConstraint Element (Association SSDL)