Data Access has been discontinued. Please refer to this page for more information.

How to: Handle the naming of navigation properties in 1:m self referencing relationship

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

This article will show one of the ways to handle the naming of navigation properties generated for a 1:m self referencing relationship. For the example, suppose you have the following database schema:

If you generate a Domain Model based on such database without modifying the naming rules for navigation properties, you will end up with rather ambiguous names as shown in the following model:

To resolve the problem you can modify the naming rules for the generated navigation properties by following these steps:

  1. When using the Create Model Wizard, go to the Define Naming Rules screen.
  2. Select the Navigations tab and:

    • Set Base Reference Name On to Foreign Key Property.
    • Set Base Coolection Name On to ForeignKeyProperty_Class
    • Remove the "Id" suffix from the foreign key property name part of the navigation property names.
    • Uncheck the Aapply Property Naming Rules on the Reference Side checkbox.

The generated navigation properties will now have meaningful names Manager and Manager_Employees which are based on the names of the foreign key property of the class and a combination of the foreign key property and class names respectively.