Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: MFruit on November 04, 2008, 08:06:50 pm

Title: C# code generation for #region
Post by: MFruit on November 04, 2008, 08:06:50 pm
Hello,
Is anybody know if is it possible to generate #region code for C# ?
What i saw is that reversing a class with defined #region works well. In fact, i've put in my code one region to define attributes and another one to define operation.

Code: [Select]
   public class Class1
    {
        #region Attribute
        int Attribute1;
        int Attribute2;
        private bool Attribute3;
        #endregion

        #region Operation
        public string Class1Operation2(int Id)
        {
            return "";
        }

        public void Class1Operation1(){ }

        public bool Class1Operation3(int Id2){
           return true;
        }
        #endregion
    }

Then reverse the class. Under Enterprise Architect i add one attribute and one operation. The generating works well because the new attribute is created into #region Attribute and the new operation into #region Operation.

My question is to know if we can define region under Entreprise Architect to generate the first time a class with pre-define region ?

Thx.
Title: Re: C# code generation for #region
Post by: Eve on November 05, 2008, 08:01:03 am
Modify the code templates.

You'll find a list over attributes and a list over operations.  Just add the appropriate region code (in plain text) to the template and you'll be fine.