Author Topic: A question about Associate Connection  (Read 1511 times)

palatum

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
A question about Associate Connection
« on: October 13, 2003, 11:16:40 pm »
Associate Connection should generate an array for the target class. But I meet a problem in EA(3.51.606). EA generate the C# code and it is not an array. the generated code is:

Functions.cs
Code: [Select]

namespace Logical Model
{
     public class Functions {
           public Functions(){
           }

           protected virtual void Finalize(){
           }

           public virtual void Dispose(){
           }

     }//end Functions

}//end namespace Logical Model


FunctionMap.cs
Code: [Select]

namespace Logical Model{

     public class FuncMap {

           public Functions m_Functions;
                               //Here, I want public Functions[] m_Functions

           public FuncGroup(){

           }

           protected virtual void Finalize(){

           }

           public virtual void Dispose(){

           }

     }//end FuncGroup

}//end namespace Logical Model

The EA file  
http://www.cjsdn.com/user/download/56670/Test.rar
The UML image
« Last Edit: October 13, 2003, 11:18:23 pm by palatum »

fluxtah

  • EA User
  • **
  • Posts: 144
  • Karma: +0/-0
    • View Profile
Re: A question about Associate Connection
« Reply #1 on: January 31, 2004, 03:09:18 pm »
I get this problem also, on doing a reverse engineer of pre-written code, using the same basic model like yours above, EA does not see attributes such as SomeObject[] associated to the class SomeObject....  however EA does import association links when the associated object without the [].

On forward engineer of a model like yours above, I also get the problem you describe, Ive tried setting the attribute of the target to have multiplicity and that does'nt seem to help.

Not sure how to answer this one but I would like to know how to get EA, if possible to recognise arrays on import/export.

- Fluxtah
« Last Edit: January 31, 2004, 03:11:46 pm by fluxtah »

fluxtah

  • EA User
  • **
  • Posts: 144
  • Karma: +0/-0
    • View Profile
Re: A question about Associate Connection
« Reply #2 on: February 02, 2004, 10:03:58 am »
Been looking into this more and now realise what you need to do. Take a look at this following diagram, I am using composition here but the same steps should work for association.



If you double click on the class that you want to be a collection, in my case Wheel, in the class properties panel click the detail tab, click the collection classes button and type in the name of the collection, in my case I typed in 'Wheel[]' , in the default collection class text box, there is more info about it on SettingCollectionClasses.htm of the manual.

The code generation from my diagram above:
Code: [Select]
     public class Car {

           private Wheel[] wheels;
           public SteeringWheel steeringwheel;

           public Car(){

           }

     }//end Car



Another way to do this that will override the above settings is to set the Member Type text box in the source role/target role pages of the association properties panel.
« Last Edit: February 02, 2004, 07:58:23 pm by fluxtah »