Book a Demo

Author Topic: Turn on AutoNum when transforming to DDL  (Read 5270 times)

Owl Saver

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • Never give up.
    • View Profile
Turn on AutoNum when transforming to DDL
« on: May 07, 2012, 12:32:00 pm »
I am creating a domain model using the DDL transformation. I would like it to genrate all the keys with AutoNum turned on. I looked at the template and found the place where I think it should be done. But, I do not know how to specify the AutoNum property and what value to use to set it to true.

Below is the section from the template where I am trying to modify. My guess is I need to add a line like:

AutoNum = true

But, that does not work. Any help would be great.


%if elemType != "Association"%
  PrimaryKey
  {
    Column
    {
      name=%qt%%CONVERT_NAME(className, "Pascal Case","Camel Case")%ID%qt%
      type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
    }
  }
%endIf%

Thomas_Arnbjerg

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Turn on AutoNum when transforming to DDL
« Reply #1 on: January 29, 2014, 05:14:25 pm »
Did anyone know the answer for this? I have the same question.

Thomas_Arnbjerg

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Turn on AutoNum when transforming to DDL
« Reply #2 on: January 29, 2014, 05:18:45 pm »
The solution is to patch the template 'class' in the DDL transformation with an autonumber element as shown below:

  PrimaryKey
  {
    Column
    {
      name=%qt%uniqueId%qt%
      type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
      autonumber
{
      Startnum="1"
      increment="1"
}
    }

  }

Owl Saver

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • Never give up.
    • View Profile
Re: Turn on AutoNum when transforming to DDL
« Reply #3 on: January 30, 2014, 12:20:39 am »
Thanks, I will give this a try.