Book a Demo

Author Topic: Class Diagram Show Relationship Field  (Read 2904 times)

marksisson

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Class Diagram Show Relationship Field
« on: November 04, 2011, 10:47:20 am »
When I'm drawing a class diagram and creating relationships between classes, how do I define the actual variable name that will be used in the class for the relationship?  As an example: if I have and Order class and an OrderDetail class.  In my EA class diagram I have drawn an association between the two.  When I forward engineer those two classes, my OrderDetail has a class variable named m_Order.  Where do I change that?  Also, how do I get my class diagram to show that as a property of my class?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Class Diagram Show Relationship Field
« Reply #1 on: November 07, 2011, 08:29:07 am »
In the connector properties dialog you'll find a 'Target Role' page. The top item in this page is the name of the attribute.

In the options dialog under Source Code Engineering there are options to control if an unnamed role should be generated and what its default name should be.

marksisson

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Class Diagram Show Relationship Field
« Reply #2 on: November 08, 2011, 04:21:36 am »
Thx for the info Simon.  I'm still not getting what I'm looking for though.  When I added the target name as you've suggested, all that does is add a label on the connector itself.  I want an attribute to show up on my Order class called Details and specify that it's type is IList<OrderDetail>.

Am I forced to add this as an attribute myself then (which I've started to do all over my model now)?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Class Diagram Show Relationship Field
« Reply #3 on: November 08, 2011, 08:31:55 am »
They are different representations of the same thing, but EA won't create the attribute on your class until after reverse engineering.