Show TOC

Define Referential ConstraintsLocate this document in the navigation structure

This document describes defining Referential Constraints for the Service Builder projects complying with OData V4

Context

Referential Constraint denotes which of its properties are tied to which properties of a related entity type. These properties need not to be a key property. A referential constraint asserts that the Property Path (the property defined on the parent Entity Type containing the Navigation Property) and Referenced Property Path (the referenced property defined on the Entity Type mentioned in the Target Type of the Navigation Property) MUST have the same value.

Prerequisites
You should have already created
  • OData V4 Service Builder project
  • One or more Entity Type
  • One or more Properties for each Entity Types
  • One or more Navigation Property for each Entity Types
Procedure
To define Referential Constraint, proceed as follows:
  1. Expand Start of the navigation path Data Model  Next navigation step Entity Types End of the navigation pathfolder in the tree view of your project.
  2. Double Click on Navigation Property folder for which you want to define a Referential Constraint.
  3. Double click on Referential Constraints sub folder to open the Mass Edit View.
  4. Click Display <-> Change to change to edit mode
  5. Click Insert Row to insert a row or Append Row to append a row for creating a new navigation property.
  6. In Property Path column, manually enter the path of the Property of parent Entity Type. Alternatively press F4 for value help. The Property List window appears. Select a property from the Path Selection Data and press Enter.
  7. Property Path Editor column allows you to make manual entry of the property path in Path Editor window.
  8. In Referenced Property Path column manually enter the path of the property of Entity Type mentioned as Target Type in the parent Navigation Property. Alternatively press F4 for value help. The Property List window appears. Select a property from the Path Selection Data and press Enter.
  9. Referenced Property Path Editor column allows you to make manual entry of the referenced property path in Path Editor window.
  10. Click Save to save the changes made.
Note

Path Selection Data displays all the levels of complex type property. Here, you can select only a primitive property as the path for Property path or Referenced Property Path. On selecting a primitive property (or core property) in the list, Property Path/Referenced Property Path constructs and displays the complete path of the selected property.

If you select a complex property, an error message is displayed.