Define Naming Rules Dialog
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.
The Naming Rules dialog is part of the Telerik Data Access Create Model Wizard, which enables you to specify various naming settings and rules to be applied on the generated domain model.
The rules described in this topic applies to Database First Scenario only. The Define Naming Rules dialog will appear only if the selected domain model type is Populate from Database.
For more information and practical examples, check out Modifying Naming Settings.
The Naming Rules dialog consists of three parts - naming rules for:
Naming Rules for Classes
The Classes tab pages offers the following options:
- Add prefix - specifies a prefix to be added to the generated objects.
- Add suffix - specifies a suffix to be added to the generated objects.
- Remove prefix(es) - specifies a prefix to be removed from the generated classes. The wizard allows you to remove multiple prefixes. For that purpose, the values in the Remove prefix(es) text box should be separated with a comma or semicolon separator.
- Remove suffix(es) - specifies a suffix to be removed from the generated classes. The wizard allows you to remove multiple suffixes. For that purpose, the values in the Remove suffix(es) text box should be separated with a comma or semicolon separator.
-
Case - controls the object casing. The following options are available:
- Unchanged - no changes will be applied. This is the default value.
- Capitalize - generates all objects with its first letter as uppercase letter.
- Camel Case - a practice of writing compound words in which the elements are joined without spaces, with each element's initial letter is capitalized. The first letter is a lowercase letter.
- Pascal Case - a practice of writing compound words in which the elements are joined without spaces, with each element's initial letter is capitalized. The first letter is an uppercase letter.
- Lower - all objects are generated in lowercase.
- Upper - all objects are generated in uppercase.
-
Pluralization - controls the object pluralization. The following options are available:
- Unchanged - no changes will be applied. This is the default value.
- Singularize - in order to understand correctly this option, consider the following situation: If you have a table named Products in the database, and the pluralization option is set to Singularize, the generated entity will be Product. The wizard "assumes" that your tables are in plural form and will try to make the generated classes in singular form.
- Pluralize - in order to understand correctly this option, consider the following situation: If you have a table named Product in the database, and the pluralization option is set to Pluralize, the generated entity will be Products. The wizard "assumes" that your tables are in singular form and will try to make the generated classes in plural form.
- Remove Underscores - removes underscores from the object name.
- Treat Underscore as Word Delimiter - the idea behind this option is the following: in cases when a table contains underscores usually they are used to divide the words in the name, for instance "Order_Details". Usually this "Interpret underscore as word delimiter" option is used together with the CamelCase or PascalCase modes where each word in the name, should begin with a capital letter. Having this in mind, by default "Order_Details" would be considered one word. So by enabling this option you claim that the underscore character are not part of the words but are their delimiters and "Order_Details" are two words. At the end, if this option is enabled and PascalCase or CamelCase mode is selected, the end result should be "OrderDetail" as a class name, instead of "Orderdetail" or "Order_detail".
- Treat Capital Letters as Word Delimiter - treats every capital letter as the start of a new word.
- Add Schema Name as Prefix - adds the database schema name as a prefix to the generated objects. This is useful when generating objects from more than one schema.
Naming Rules for Fields
The Fields tab pages exposes the following options:
- Add prefix - specifies a prefix to be added to the generated fields.
- Add suffix - specifies a suffix to be added to the generated fields.
- Remove prefix(es) - specifies a prefix to be removed from the generated fields. The wizard allows you to remove multiple prefixes. For that purpose, the values in the Remove prefix(es) text box should be separated with a comma or semicolon separator.
- Remove suffix(es) - specifies a suffix to be removed from the generated fields. The wizard allows you to remove multiple suffixes. For that purpose, the values in the Remove suffix(es) text box should be separated with a comma or semicolon separator.
-
Case - controls the field casing. The following options are available:
- Unchanged - no changes will be applied. This is the default value.
- Capitalize - generates all fields with its first letter as uppercase letter.
- Lower - all fields are generated in lowercase.
- Upper - all fields are generated in uppercase.
-
Pluralization - controls the fields pluralization. The following options are available:
- Unchanged - no changes will be applied. This is the default value.
- Singularize - in order to understand correctly this option, consider the following situation: If you have a column named Names in the database, and the pluralization option is set to Singularize, the generated field will be _name. The wizard "assumes" that your columns are in plural form and will try to make the generated fields in singular form.
- Pluralize - in order to understand correctly this option, consider the following situation: If you have a column named Name in the database, and the pluralization option is set to Pluralize, the generated field will be _names. The wizard "assumes" that your tables are in singular form and will try to make the generated fields in plural form.
- Collections Pluralization - controls the pluralization of the collection fields.
- Remove underscores - remove underscores from the field name.
- Treat Underscore as Word Delimiter - treats every capital letter as the start of a new word.
- Treat Capital Letters as Word Delimiter - treats every capital letter as the start of a new word.
Naming Rules for Properties
The Fields tab pages exposes the following options:
- Add prefix - specifies a prefix to be added to the generated properties.
- Add suffix - specifies a suffix to be added to the generated properties.
- Remove prefix(es) - specifies a prefix to be removed from the generated properties. The wizard allows you to remove multiple prefixes. For that purpose, the values in the Remove prefix(es) text box should be separated with a comma or semicolon separator.
- Remove suffix(es) - specifies a suffix to be removed from the generated properties. The wizard allows you to remove multiple suffixes. For that purpose, the values in the Remove suffix(es) text box should be separated with a comma or semicolon separator.
-
Case - controls the property casing. The following options are available:
- Unchanged - no changes will be applied. This is the default value.
- Capitalize - generates all properties with its first letter as uppercase letter.
- Lower - all properties are generated in lowercase.
- Upper - all properties are generated in uppercase.
-
Pluralization - controls the properties pluralization. The following options are available:
- Unchanged - no changes will be applied. This is the default value.
- Singularize - in order to understand correctly this option, consider the following situation: If you have a column named Names in the database, and the pluralization option is set to Singularize, the generated property will be Name. The wizard "assumes" that your columns are in plural form and will try to make the generated properties in singular form.
- Pluralize - in order to understand correctly this option, consider the following situation: If you have a column named Name in the database, and the pluralization option is set to Pluralize, the generated property will be Names. The wizard "assumes" that your columns are in singular form and will try to make the generated properties in plural form.
- Collections Pluralization - controls the pluralization of the collection properties.
- Remove underscores - remove underscores from the field name.
- Treat Underscore as Word Delimiter - treats every capital letter as the start of a new word.
- Treat Capital Letters as Word Delimiter - treats every capital letter as the start of a new word.
Naming Rules for Navigation Properties
The Navigations tab exposes settings which allow you to customize the naming rules for navigation properties in one to many association:
-
Base Reference Name On - using this setting you can specify on which string should the name of the reference navigation property be based on. The following choices are available:
- Class - the name of the reference navigation property will be based on the name of the class at the opposite end of the association. This is the option selected by default.
- Foreign Key Property - the name of the reference navigation property will be based on the name of the foreign key property found in the same class.
-
Base Collection Name On - this setting allows you to specify which string should be used to generate the name of the collection navigation property. You can choose from the following options:
- Class - the name of the collection navigation property will be based on the name of the class at the opposite end of the association. This is the option selected by default.
- Class_ForeignKeyProperty - the name of the collection navigation property will be based on a combination of the names of the class at the opposite end of the association and its foreign key property.
- ForeignKeyProperty_Class - the name of the collection navigation property will be based on a combination of the name of the foreign key property of the class at the opposite end of the association and the name of the class.
- Add Prefix to Foreign Key - allows you to add a prefix to the foreign key name part of the names of navigation properties.
- Add Suffix to Foreign Key - allows you to add a suffix to the foreign key name part of the names of navigation properties.
- Remove Prefix(es) from Foreign Key - allows you to remove prefixes from the foreign key part of the names of navigation properties.
- Remove Suffix(es) from the Foreign Key - allows you to remove suffixes from the foreign key part of the names of navigation properties.
-
Foreign Key Reference Pluralization - this setting allows you to change the pluralization of the foreign key part of the names of navigation properties. The following options are available:
- Unchanged - no changes will be made to the foreign key part of the names of navigation properties. This is the option selected by default.
- Singularize - if the foreign key part of the names of navigation properties is in plural form it will be singularized.
- Pluralize - if the foreign key part of the names of navigation properties in in singular form it will be pluralized.
-
Collections Pluralization - with this setting you can change the pluralization of the names of collection navigation properties. The following options are available:
- Unchanged - the generated name of the collection navigation property will not be modified.
- Singularize - if the generated name of the collection navigation property is in plural form it will be singularized.
- Pluralized - if the generated name of the collection navigation property is in singular form it will be pluralized. This is the option selected by default
- Apply Property Naming Rules on the Reference Side - with this setting you can determine whether to apply the property naming rules when generating the names of your navigation properties. This option is enabled by default. Note that when using Apply Property Naming Rules on the Reference Side, property naming rules are applied before navigation property naming rules.