Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: nlecart on March 16, 2012, 12:37:14 am

Title: develop a specific plugin to interpret C# annotati
Post by: nlecart on March 16, 2012, 12:37:14 am
Hello,

We bought EA to support all our software conception.
But we are facing a problem with the reverse capacity of EA.
In our C# code we use c# annotation to specify relationship between classes

For example, to specify a composition relation between a person class and a PersonStatus class, we code this like that:
////composition
      
#region PersonStatus
        [OwnedObject(typeof(PersonStatus), Constants.CatBSOStatus,
               new string[] { CreateRoles},
               new string[] { ReaderRoles },
               new string[] { UpdateRoles },
               new string[] { DeleteRoles },
               false,
               Constants.CatOwnedObjectsDisplayOrder + 1,
               "PersonStatusOwnership",
               true, false, false)]
        public string statusID{ get; }

        #endregion PersonStatus

This means that a Person object can contain 0..N PersonStatus objects

//relationship
#region Person Address Relation
        [RelationAttribute(typeof(PersonAddress),            Constants.PersonAddressRelation,
            Constants.AddressRelationshipLabel,
            new string[] { CreateRoles},
               new string[] { ReaderRoles },
               new string[] { UpdateRoles },
               new string[] { DeleteRoles },
            true,
            typeof(BSOAddress),
            Constants.CatRelationshipsDisplayOrder + 0,
            true)]
        public string PersonAddressID { get; set; }
        #endregion Person Address Relation

This means that a person object can be link to 0..N PersonAdress objects

From this code, we would like EA :
-      to generate a UML aggregation link between Person and PersonAdress
-      to generate a UML composition link between  Person PersonStatus

have you ever experienced this ?

can the SDK of EA can help us to develop such a behavior?

Thank you very much for your help
Title: Re: develop a specific plugin to interpret C# anno
Post by: Geert Bellekens on March 16, 2012, 05:23:58 pm
Sure using the EA API it should be possible to go over the code after reverse engineering the code, and add the required relations.
If you are looking for a place to start:
Tutorial: Create your first C# Enterprise Architect addin in 10 minutes (http://geertbellekens.wordpress.com/2011/01/29/tutorial-create-your-first-c-enterprise-architect-addin-in-10-minutes/)
If you are looking for examples:
https://github.com/GeertBellekens

Geert
Title: Re: develop a specific plugin to interpret C# anno
Post by: nlecart on March 28, 2012, 03:08:08 am
Thank you Geert,

I will analyse your inputs.