Jump to content

Using a different naming convention for Components

  • Please log in to reply
1 reply to this topic

#1 Guest_tolgaerdogus_*

  • Guests

Posted 31 January 2006 - 07:28 AM


given the table name USER_INFO and column name USEINF_FIRST_NAME
how ouwld I modify the templates (and which template) to have the generated component name be UserInfo and the attribute name FirstName (skipping everything until the first _ inlcuding the first _)


#2 Guest_Paul_*

  • Guests

Posted 31 January 2006 - 08:29 AM

Yes, you can customize the object(s) name and the attributes as you've mentioned through the templates. There is a minor change required in the template ".tdp"

For C# components open the following template

%INSTALLATION PATH%\TierDeveloper .Net 5.1\Patterns\PrePackaged\CSComponent\CSComponent.tdp

Go to line number 354 (under the function GenerateCode()) and add the followin lines of code under the loop.

for(var k =0;k< Project.Objects.Count;k++)
    Project.CurrentObject = Project.Objects.item(k);

    Project.CurrentObject.Name = Replace(Project.CurrentObject.Name, "_", "");
    var Attrs = Project.CurrentObject.Attributes;
    for(var i=0; i<Attrs.Count; i++)
Replace(Attrs(i).Name, "_", "");

See the code in bold that you need to incorporate. This is just to give you an example on how to make the modifications. You need to implement the logic yourself to change the object name pattern. Template IDE uses javascript syntax and fully support javascript methods.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users