Skip to content

Target Name Transformation

Simon Mourier edited this page Feb 19, 2020 · 1 revision

Target Name Transformation (“TNT”) is a powerful and important feature of CodeModeler which allows developers to use the names of entities, properties, and views inside SQL snippets and raw queries. Therefore, it allows developers to use actual output names of objects (tables, columns, views) with the support of the defined naming convention.

The following formats are available (where the value between brackets should be replaced by the actual name):

  • $[EntityName]$ corresponds to the table name,

  • $[PropertyName]$ corresponds to the property name,

  • $[EntityName]::[PropertyName]$ corresponds to the column name,

  • $[EntityName]:[ViewName]$ corresponds to the view name,

  • $[EntityName]:[ViewName]:[PropertyName]$ corresponds to a column name in the defined view,

  • $[Namespace].[EnumerationName].[EnumerationValue]$ corresponds to the enumeration value of an enumeration declared in the model.

Note: If ever a $EntityName$ and a $PropertyName$ conflicts, the entity name prevails.

For example, in the following image, we define a load raw method on a Customer entity but we want the method to be independent from the final table an column names:

Target Name Transformation - Picture 227

We have also configured the entity persistence name to be “tlb_cus”:

Target Name Transformation - Picture 228

And the property MyDate persistence name to be “dt” (“Advanced Properties” tab):

Target Name Transformation - Picture 229

Then the output SQL will be:

(...)
SELECT * FROM [tbl_cus] WHERE [tbl_cus].[dt] = @currentDate
(...)

TNT can be used in unchecked and raw methods to allow developers to write CMQL methods mixed with platform specific code such as T-SQL as above.

Clone this wiki locally