How to: Add\Remove Prefixes and Suffixes
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 first group of settings regard the prefixes and suffixes added/removed to/from the generated item.
Here you could:
- Add a prefix or suffix to the class (property or field) name
- Remove prefix(es) or suffix(es) from the class (property or filed) name
- Adding Schema Name as Prefix
Adding Prefixes and Suffixes
To add new prefix and suffix, you need to use the Add prefix and Add suffix options. For example, specifying a prefix "My" and suffix "Object" will result in generating a new class with name "MyCustomerObject".
Specifying a prefix and/or suffix for fields or properties is equivalent.
Removing Prefixes and Suffixes
Alternatively, prefix(es) and/or suffix(es) can be removed. For that purpose the Remove prefix(es) and Remove suffix(es) options should be used.
In the image above, "T" will be removed from the beginning of the class name, and "Tbl" will be removed from the end of the class name. Which means that if the original name of the table is TCustomerTbl, the generated class will be named Customer. Again, when any of the settings is changed, the preview area is updated.
Removing Multiple Prefixes/Suffixes
The wizard allows you to remove multiple prefixes/suffixes. For that purpose, the values in the Remove prefix(es) and Remove suffix(es) text boxes should be separated with a comma or semicolon separator.
Consider the following example:
If your database contains tables with names TProduct and TblCategory, the generated entities will be Product and Category.
Adding Schema Name as Prefix
There is one additional option that should be mentioned here. It is the Add schema name as prefix option. If you use it, the schema name will be added as a prefix to the generated class.
Note that the Add schema name as prefix option is available only for class names. For example, if your database schema is dbo, then the generated class name could be something like dboCustomer.