How to: Add and Edit Referential Constraints (Entity Data Model Tools)

This topic describes how to add a referential constraint to a conceptual model with the Entity Data Model Designer (Entity Designer). For more information about referential constraints, see ReferentialConstraint Element (CSDL).

NoteNote

If there is a referential constraint on an association in a conceptual model, the Create Database Wizard propagates the referential constraint to the database. For more information, see Generate Database Wizard (Entity Data Model Tools) and Database Generation Rules (Generate Database Wizard).

Adding or Editing a Referential Constraint in a Conceptual Model

When you use the Entity Designer to add or edit a referential constraint in a conceptual model, the Entity Designer adds or modifies a ReferentialConstraint element in the CSDL content of the .edmx file.

To add or edit a referential constraint in a conceptual model

  1. Double-click the association that you want to edit.

    The Referential Constraint dialog box appears.

  2. From the Principal drop-down list, select the principal entity in the referential constraint.

    The entity's key properties are added to the Principal Key list in the dialog box.

  3. From the Dependent drop-down list, select the dependent entity in the referential constraint.

  4. For each principal key that has a dependent key, select a corresponding dependent key from the drop-down lists in the Dependent Key column.

  5. Click OK.

See Also

Concepts

ADO.NET Entity Data Model Designer

Other Resources

Generate Database Wizard (Entity Data Model Tools)
Defining and Managing Relationships (Entity Framework)