Book a Demo

Author Topic: Code Templates  (Read 2853 times)

SmellyNoodle

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Code Templates
« on: July 02, 2008, 04:38:10 am »
I need to generate some extra code when the class that I'm forward engineering has a port on it.  I know that the ports are embedded elements within the class.  And I can see that they're stored as objects with a parent ID.

However, I can't seem to find a way to access them within a Code Template.  Has anyone managed this before, does anyone have any idea how I might achieve it?

Many thanks,

SN


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Code Templates
« Reply #1 on: July 02, 2008, 08:16:49 am »
Ports are currently not accessible directly from code templates.  If you want to generate code from them, you'll have to do one of two things.

1. Use a transform to generate a model that EA can generate from.
2. Call an add-in from your code templates. There are examples on the forum if your search for EXEC_ADD_IN.

I'm curious, what are you wanting to generate.  Different people seem to expect different things, and I'm currently looking into some related areas.

SmellyNoodle

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Code Templates
« Reply #2 on: July 02, 2008, 09:16:03 am »
Simon,

Thanks very much for your prompt and helpful reply.  I will take a look at the options you presented tomorrow.

As for what we're wanting to generate... well.  In our interpretation of ports we see them as fairly dumb classes -  essentially routers - that all operate in a similar way.  We have come up with a standard way of both implementing and using the ports to ensure that our developers don't get bogged down in understanding how the infrastructure works and instead can concentrate on solving the real problem.  

To help ensure that the implementation of the port is common we have a port base class.  And to help ensure that the ports are always used the same way we were looking to update the code templates to ensure that all of the basic plumbing is always done the same way.

Does that help you understand what we're looking for?  If you need anymore details let me know, I'll be happy to expand and clarify anything that needs doing so.

Cheers...