This documentation is archived and is not being maintained.

ReferentialConstraint Element (SSDL)

The ReferentialConstraint element in store schema definition language (SSDL) represents a foreign key constraint (also called a referential integrity constraint) in the underlying database. The principal and dependent ends of the constraint are specified by the Principal and Dependent child elements, respectively. Columns that participate in the principal and dependent ends are referenced with PropertyRef elements.

The ReferentialConstraint element is an optional child element of the Association element. If a ReferentialConstraint element is not used to map the foreign key constraint that is specified in the Association element, an AssociationSetMapping element must be used to do this.

The ReferentialConstraint element can have the following child elements:

Applicable Attributes

Any number of annotation attributes (custom XML attributes) may be applied to the ReferentialConstraint element. However, custom attributes may not belong to any XML namespace that is reserved for SSDL. The fully-qualified names for any two custom attributes cannot be the same.


The following example shows an Association element that uses a ReferentialConstraint element to specify the columns that participate in the FK_CustomerOrders foreign key constraint:

<Association Name="FK_CustomerOrders">
  <End Role="Customers" 
       Type="ExampleModel.Store.Customers" Multiplicity="1">
    <OnDelete Action="Cascade" />
  <End Role="Orders" 
       Type="ExampleModel.Store.Orders" Multiplicity="*" />
    <Principal Role="Customers">
      <PropertyRef Name="CustomerId" />
    <Dependent Role="Orders">
      <PropertyRef Name="CustomerId" />

See Also