Book a Demo

Author Topic: Default templates output connectors twice - why?  (Read 3672 times)

danm

  • EA User
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Default templates output connectors twice - why?
« on: December 13, 2007, 08:39:47 pm »
The default templates output connectors twice, because the Connector template is called from the Class template. So for every class (two on each side of a connector), a Connector is spit out - twice as many times as necessary. Even though EA sorts it out in the end and deletes duplicates.

If the Connector template was called one level above, in the Namespace, that fixes it. Any issues with doing this?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Default templates output connectors twice - wh
« Reply #1 on: December 13, 2007, 09:16:00 pm »
It does it so that the connector will be created in all circumstances.  (Usually related to not doing the whole transform at a time)

Listing over connectors at the package level won't work because it is actually listing over the connectors to a single class.

danm

  • EA User
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: Default templates output connectors twice - wh
« Reply #2 on: December 13, 2007, 09:26:40 pm »
Ah ha - I thought there must be a reason. I won't try and 'correct' it then.

On another thought, I'm very impressed with the code template + AddIn combination. It's pretty amazing how easy and quick it is to generate models and code, once you figure it out!  ;)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Default templates output connectors twice - wh
« Reply #3 on: December 16, 2007, 12:58:18 pm »
If you want to generate it only once try adding something like the following to the top of the template.

%if connectorSourceElemGUID != classGUID%
%endTemplate%

danm

  • EA User
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: Default templates output connectors twice - wh
« Reply #4 on: December 16, 2007, 03:41:25 pm »
Seems to work fine. Nice for those of us doing extensive template rework and so need to read the intermediate file frequently during development.