Book a Demo

Author Topic: Forward engineering  (Read 3351 times)

telcontr

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Forward engineering
« on: February 15, 2005, 11:26:07 am »
I have a C# class, with one method, void Foo().
In the class file I have written some code in the method body.

What I want to do now, ist to change the return value of void Foo() to bool Foo(). I want to do this in EA, and I want to forward engineer my UML design, and at the same time keep the code I already have in the .cs file for the Foo()  implementation.

How do I do this?
According to my experience, I either overwrite the cs file and then lose my implementation code in the method body.

Or - I "synchronize" but EA then repeats the class definition in the .cs file, below, and I still do not achieve what I am after.

Have I misssed something?
To make it clear what I want - I want to update the source file without losing the code in the method bodies.

--
Ingvar Nilsen


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Forward engineering
« Reply #1 on: February 15, 2005, 01:57:59 pm »
What you want to do is synchronising, but build 747 has a bug that causes the generator not to recognise any C# namespace with a dotted name (ie. namespace A.B {})  As a result the generator assumes that the class you are generating doesn't exist and generates it out again.

The fix is in build 748, which should be out soon.

In the mean time there is is workaround that should restore the behaviour of pre 745.  When synchronising turn the generate Namespace option off.  If you do this it will ignore the namespace.  The only downside that I can see at the moment is that the level of indenting will be out.

Simon

telcontr

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Forward engineering
« Reply #2 on: February 15, 2005, 02:18:24 pm »
Ok, this works.
However, there are other topics that are unclear to me.

When I add a parameter to my Foo() method, like Foo(string Test), when forward engineering this EA creates a new method in the source file, instead of modifying the existing.
So I now have Foo() and Foo(string Test).

Is this by design?

I would rather have the existing method modified.

--
Ingvar Nilsen

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Forward engineering
« Reply #3 on: February 15, 2005, 02:22:04 pm »
Yes, this is by design.  It doesn't automatically synchronise with the method because the signature has changed and it very likely could be a different method.

The solution is to go into the Attribute/Operations page in the help and check "On forward synch, prompt to delete code features not in model".  That will bring up a dialog saying what it found in the code that wasn't in the model and allow you to specify what it corresponds to in the model.

Simon