Condividi tramite


ReferentialConstraint Element (Association SSDL)

The ReferentialConstraint element on an Association specifies direction in a relationship in the store schema definition language (SSDL) within the Entity Data Model (EDM). A ReferentialConstraint in SSDL is based on a foreign key constraint in the data source. Associations in the EDM are navigable in either direction; the roles of the Principal Role and Dependent Role elements of a ReferentialConstraint have corresponding foreign key relationships in the database.

The following schema specifies direction using the Principal Role and Dependent Role attributes of a ReferentialConstraint element. In the data table, the DependentRole has a foreign key containing the 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 (CSDL)
Navigation Properties (EDM)