Book a Demo

Author Topic: MDG Link / C# / Merge synchronize and Association  (Read 3534 times)

MFruit

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
MDG Link / C# / Merge synchronize and Association
« on: July 10, 2008, 10:49:21 pm »
I encounter some difficulties between EA UML model and C# code generation and reversing.

Here are the elements which drive to questionings

Step 1: create a new EA UML project and use MDG Link with a Visual Studio 2008 project

Step 2: create a simple class diagram, 2 classes (no attribute, no operation) with a direct association (multiplicity 0..1). Class1 pointing to Class2

Step 3: in the EA Project Browser, right click on the package containing the class diagram and the two classes, Using “Add-In” / “Merge with Visual Studio” / select Type “Both”.  Associate classes with file name

Before reverse, just look to code generation:
Class1.cs
public class Class1 {
   public Class2 Asso;
}

Class2.cs
public class Class2 {
   //futur code
}

Then reverse each Class into model:
An attribute "Asso: Class2" is created under Class1 and the association is still visible.

Question 1: Why EA creates' an attribute called “Asso” under Class1 ? What is perturbing is that we have two objects with the same name (attribute called “Asso:Class2” and association with target role called “Asso”).

Step 4: updating Class1.cs (code) and rename the association name “Asso” to “Asso_Update”
 
Step 5: Using “Add-In” / “Merge with Visual Studio” / select Type “Both”, then click to reverse both Class1 and Class2
 
Have a look to the class diagram:
An attribute "Asso: Class2" still here under Class1 and the association "Asso" is still visible.
An attribute "Asso_Update: Class2" under Class1 and an association created with "Asso_Update" as target role name.

Question 2: Why does the reverse create a new attribute? can’t see that the previous attribute already exists?  Same for the association, a new one is created, why ?

Question 3: Do you believe that such synchronization will perfectly fit with a professional context? (Complex model implementation, with a lot of associations and classes).

Is there something that I didn’t see with option or whatever?

Question 4: Similarly problem with N-Array  association (0..*). Attribute is created, but not association. Why ?

If someone met one day such difficulties and found solution, or another way to work with, please answer.
Thanks very much.