Book a Demo

Author Topic: Roundtrip-Engineering Problem: "virtual"  (Read 3657 times)

SR_SXP

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • User of  EA 6.5.799
    • View Profile
Roundtrip-Engineering Problem: "virtual"
« on: October 19, 2006, 09:23:30 am »
Hi,

I'm using EA only for a few weeks now and so do not have too much experience with that tool. Maybe someone can help me with my following problem:


I'm trying to roundtrip engineer a project written in C#.

There I've got the following simple class structure:

* CLASS_A is BASE of CLASS_B
* CLASS_A defines some methods as virtual (but note pure virtual).

When I forward engineer these classes, the these methods of CLASS_A are also generated in CLASS_B.
How can I avoid this so that these methods are NOT generated?

Note:
In the class diagram within EA, these methods are NOT listed at CLASS_B.


Another question:
When generating enumerations in C# I'd like to have the following code generated:

Code: [Select]

 public enum SortOrder
 {
   Ascending,

   Descending
 }


But the following is generated by EA:

Code: [Select]

 public enum SortOrder : int
 {
   Ascending,

   Descending
 }


How can I avoid the ": int" from appearing?



Any hint or help is very appreciated! :)
Thanks in advance!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Roundtrip-Engineering Problem: "virtual&q
« Reply #1 on: October 19, 2006, 09:39:37 am »
First question: I'm not sure, but have you tried changing the visibility of the methods in A?

Second question: Long ago I asked Sparx about including an option to diaplay completely unadorned attribute names. No significant response.

I'll raise the second one as a Suggestion in the forum as well as requesting the feature - but it will be a day or so. Please watch for the thread and add your vote.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Roundtrip-Engineering Problem: "virtual&a
« Reply #2 on: October 19, 2006, 04:22:46 pm »
You first issue.  Can you confirm what properties the operations have.  C# doesn't use the abstract field like C++ to model virtual.  Instead it uses a tagged value.  (See http://www.sparxsystems.com.au/EAUserGuide/csharp_conventions.htm)

So if the operation is marked as abstract, I think it will be picked up and added through the following option:

Tools | Options | Attribute/Operations | Generate methods for implented interfaces.

Turning that off should stop them being generated.

Your second issue is a matter of customizing the code templates.  Open Settings | Code Generation Templates, set the language to C#, select Class Declaration from the top list and enumeration from the bottom one.  Change the last line of that template from %classTag:"enumType" ? ": " value : ": int"% to %classTag:"enumType" ? ": " value%

SR_SXP

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • User of  EA 6.5.799
    • View Profile
Re: Roundtrip-Engineering Problem: "virtual&a
« Reply #3 on: October 20, 2006, 01:56:01 am »
Thanks a lot for the advice to both of you!  :D

Issue 1 was solved by the "Tools | Options | Attribute/Operations | Generate methods for implented interfaces" switch.

Issue 2 was solved by editing the mentioned template.

Have a nice day!