Define Naming Rules
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 Define Naming Rules screen allows you to configure how the names for classes, fields, properties and navigation properties would be generated. These rules will be applied when generating the persistent classes based on the schema of the chosen database.
The Define Naming Rules dialog will appear only if the selected Fluent Model type is Populate from Database
The settings are distributed in four tabs depending on the element they affect:
Naming Rules for Classes
The Classes tab exposes the following settings:
- Add Prefix - specifies a prefix that will be added to the names of the generated persistent classes.
- Add Suffix - specifies a suffix that will be added to the names of the generated persistent classes.
- Remove Prefix(es) - specifies a prefix that will be removed from the names of the generated persistent classes. You can specify multiple prefixes by separating them with comma or semicolon.
- Remove Suffix(es) - specifies a suffix that will be removed from the names of the generated persistent classes. You can specify multiple suffixes by separating them with comma or semicolon.
-
Case - controls the casing of the class names.
- Unchanged - no changes will be applied. This is the default option.
- Capitalize - the class names will be generated with a capital first letter.
- Camel Case - the very first letter is lower case. Consecutive words in the name are each delimited by a capital letter.
- Pascal Case - each consecutive word in the class name starts with a capital letter.
- Lower - the name is entirely in lower case letters.
- Upper - the name is entirely in upper case letters.
-
Pluralization - controls the pluralization of the class names. The following options are available:
- Unchanged - no changes will be applied to the name.
- Singularize - in case the name is in plural form, for example Users, it will be singularized - to User. This is the default option.
- Pluralize - in case the name is in singular form, for example User, it will be pluralized to - to Users.
- Remove Underscores - removes underscore from the class names.
- Treat Underscore as Word Delimiter - treats every underscore as a word delimiter.
- Treat Capital Letters as Word Delimiter - treats every capital letter as a word delimiter.
- Add Schema Name as Prefix - adds the table schema name as a prefix to the class which is responsible for the respective table.
Naming Rules For Fields
The Fields tab exposes the following settings:
- Add Prefix - specifies a prefix that will be added to the names of the fields.
- Add Suffix - specifies a suffix that will be added to the names of the fields.
- Remove Prefix(es) - specifies a prefix that will be removed from the names of the fields. You can specify multiple prefixes by separating them with comma or semicolon.
- Remove Suffix(es) - specifies a suffix that will be removed from the names of the fields. You can specify multiple suffixes by separating them with comma or semicolon.
-
Case - controls the casing of the fields names.
- Unchanged - no changes will be applied.
- Capitalize - the fields names will be generated with a capital first letter.
- Camel Case - the very first letter is lower case. Consecutive words in the name are each delimited by a capital letter. This is the default option.
- Pascal Case - each consecutive word in the field name starts with a capital letter.
- Lower - the name is entirely in lower case letters.
- Upper - the name is entirely in upper case letters.
-
Pluralization - controls the pluralization of the class names. The following options are available:
- Unchanged - no changes will be applied to the name. This is the default option.
- Singularize - in case the name is in plural form, for example Users, it will be singularized - to User.
- Pluralize - in case the name is in singular form, for example User, it will be pluralized to - to Users.
- Remove Underscores - removes underscore from the class names.
- Treat Underscore as Word Delimiter - treats every underscore as a word delimiter.
- Treat Capital Letters as Word Delimiter - treats every capital letter as a word delimiter.
Naming Rules for Properties
The Properties tab exposes the following settings:
- Add Prefix - specifies a prefix that will be added to the names of the properties.
- Add Suffix - specifies a suffix that will be added to the names of the properties.
- Remove Prefix(es) - specifies a prefix that will be removed from the names of the fields. You can specify multiple prefixes by separating them with comma or semicolon.
- Remove Suffix(es) - specifies a suffix that will be removed from the names of the fields. You can specify multiple suffixes by separating them with comma or semicolon.
-
Case - controls the casing of the fields names.
- Unchanged - no changes will be applied.
- Capitalize - the fields names will be generated with a capital first letter.
- Camel Case - the very first letter is lower case. Consecutive words in the name are each delimited by a capital letter.
- Pascal Case - each consecutive word in the field name starts with a capital letter. This is the default option.
- Lower - the name is entirely in lower case letters.
- Upper - the name is entirely in upper case letters.
-
Pluralization - controls the pluralization of the class names. The following options are available:
- Unchanged - no changes will be applied to the name. This is the default option.
- Singularize - in case the name is in plural form, for example Users, it will be singularized - to User.
- Pluralize - in case the name is in singular form, for example User, it will be pluralized to - to Users.
- Remove Underscores - removes underscore from the class names.
- Treat Underscore as Word Delimiter - treats every underscore as a word delimiter.
- Treat Capital Letters as Word Delimiter - treats every capital letter as a word delimiter.
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.