This article will show one of the ways to handle the combination of set Property and Navigation Property Naming rules. For the example, assume you have a database schema like the following:
If you generate a Domain Model based on such database without modifying the naming rules for the properties and navigation properties, you will end up with ambiguous names which do not comply to standard naming conventions and:
Ideally the names of the properties would be in PascalCase, there would be no underscores present in them and the navigation properties will have meaningful names. To achieve such result you can follow these steps:
- When using the Create Model Wizard, go to the Define Naming Rules screen.
Select the Properties tab and:
- Remove the "fk" suffix from the names of the properties.
- Check the Remove Underscores checkbox.
Check the Tread Undersocres as Word Delimiter checkbox.
Select the Navigations tab and:
- Set Base Reference Name On to Foreign Key Property
- Set Base Collection Name On to ForeignKeyProperty_Class
- Add suffix "Ref" to the foreign key property part of the navigation properties names.
Leave the Apply Property Naming Rules On The Reference Side checkbox checked.
The resulting model will have convention compliant property names and meaningful navigation property names.