Book a Demo

Author Topic: C# code generation issue  (Read 3201 times)

Bokkie

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • Lima Bravo!
    • View Profile
C# code generation issue
« on: July 07, 2006, 02:40:29 am »
Small issue in the C# code generation template:
When I generate a class within e.g. namespace bla the template generates a using bla for that class as well.

Example:
Code: [Select]

using bla;
namespace bla {
public class Switch {


Any ideas?
Lima Bravo!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C# code generation issue
« Reply #1 on: July 09, 2006, 08:36:43 pm »
It doesn't happen when I generate C#, so I don't know how much I can help.  But do you have modified templates?

Bokkie

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • Lima Bravo!
    • View Profile
Re: C# code generation issue
« Reply #2 on: July 11, 2006, 06:24:42 am »
I did made some minor changes to the templates but nothing special with the import section:

This is my "Import Section":
Code: [Select]

$COMMENT="WARNING: THIS IS AN ADVANCED TEMPLATE"
$COMMENT="DO NOT MODIFY UNLESS YOU ARE AN"
$COMMENT="ADVANCED USER!"
$imports = "using System;\n"
$imports += %fileImports% + "\n"
$imports += %fileHeaders% + "\n"
$imports += %list="Import" @separator="\n" importFromAggregation=="T" or importFromAssociation=="T" or importFromAtt=="T" or importFromDependency=="T" or importFromGeneralization=="T" or importFromMeth=="T" or importFromParam=="T" or importFromRealization=="T"%
%REMOVE_DUPLICATES($imports, "\n")%


As you can see, I only added "using System;" as default.
I have done a little more testing and narrowed down the problem.
The unwanted "using" is added  in the $imports += %list="Import" ... part. And it occurs in the following situation: when class A has a relation with class B (both same namespace/package) and the target role of the association is specified.

P.s. where can I change the importFrom****   variables?
Lima Bravo!

thomaskilian

  • Guest
Re: C# code generation issue
« Reply #3 on: July 12, 2006, 05:26:46 am »
What do you mean by you P.S. question?

Bokkie

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • Lima Bravo!
    • View Profile
Re: C# code generation issue
« Reply #4 on: July 12, 2006, 05:31:26 am »
appearantly, the behaviour of the ...%list="Import" ... can be influenced by e.g. importFromAggregation, importFromMeth etc... Where can I switch those from TRUE to FALSE and v.s.?
Lima Bravo!

thomaskilian

  • Guest
Re: C# code generation issue
« Reply #5 on: July 12, 2006, 05:34:40 am »
Still I didn't get the point :-/ The import*** are evaluated during macro substitution. Only if the according equation returns true, the macro is expanded. I have not found a list of available ***'s in any of the documentation files, but the one you used seems to be quite complete.