How to: Control Column Names
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.
Sometimes, during Model First Scenario, the generated database artifact names are not always what you would expect. For example, you may have a class named "ShipAddress" with a field named "spAdr" and the generated database column will be "sp_adr". Telerik Data Access allows you to specify various naming rules and settings that will be applied on the generated relational items (tables and columns) during Model First Scenario. For example, it is possible to instruct Telerik Data Access to use the property name as it is for the column name.
The Define Database Names dialog allows you to base your column names either on the field or on the property names.
- Base column names on - allows you to choose the source of the column names. You could use either the field or the property name that corresponds to the given column. For example, if you have a field "_fldCstID" and a property "CustomerID" and you have decided that the source will be the Property, then the generated column name will be "CustomerID". Respectively, if you have chosen that the Field will be used as a source, then the generated column name will be "_fldCstID".
-
Name Processing - specifies the algorithm that will be used during the name processing.
- Generate valid object names - removes any camel casing from the column name. It will also apply word breaks before each capital letter.
-
Use input string as object name - this option will leave the property/field name as it is. It will not change any casing or apply any word breaks.
Note that regardless of the selected name processing option, all invalid symbols in the property/field name will be removed. Also the generated identifier will be trimmed (if needed) so that it can match the maximum allowed length for the backend.
Check for reserved words - this option is available only if the selected name processing setting is "Use input string as object name". It controls whether reserved backend words will be replaced with words that are save to use. If the selected name processing setting is "Generate valid object names", then this option is disabled and checked, i.e. check for reserved words is always performed if you are generating valid names and it cannot be turned off.
- Delimit identifiers - controls whether the generated database identifiers will be escaped on the server.
Column Names Matching Exactly Property Names
The following configuration allows you to generate script with column names matching exactly the property names in the Visual Designer. Note that regardless of the selected name processing options, all invalid symbols in the property/field name will be removed so that you don't experience errors while running the generated script.
Column Names Matching Exactly the Field Names
The following configuration allows you to generate script with column names matching exactly the field names of your classes, without any transformation, as long as they are valid for the backend.