Book a Demo

Author Topic: (Re)generate C# code for constructor with chaining  (Read 3455 times)

MBreuer

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
(Re)generate C# code for constructor with chaining
« on: May 06, 2014, 05:30:18 pm »
Hello,
I want to reorganise the parameters in a constructor which calls the constructor of ist base class. But when I generate ist code the already existing chaining code is gone. Is there a solution to avoid this ?

class before
    public B(int i, string s)
        : base(i,s)
    {
     }

class after Generation (call of base is missing)
    public B(string s, int i)
    {
     }

thank you

webfox

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: (Re)generate C# code for constructor with chai
« Reply #1 on: May 06, 2014, 06:08:16 pm »
Hi,

after modifying the underlying code, make sure you always sync your model with it before re-generating code. To do this in EA, select the class on the diagram and press CTRL + R. If you open the properties dialog of the class and select "Tagged Values" on the left, you should now see an "initializer" tag on the right, containing the string "base(i,s)" as value. Re-generating the code from the model now will preserve your existing constructor call chain.

Hope this helps.

Cheers,

Till
« Last Edit: May 06, 2014, 06:09:49 pm by webfox »