Book a Demo

Author Topic: Namespace issue  (Read 2418 times)

jrEA

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Namespace issue
« on: February 07, 2007, 02:52:34 pm »
If a have a class diagram with two classes: Order and OrderDetail and I draw the Dependency line from the Order to the OrderDetail class, the generated code for the Order class has the using statement that is not necessary since both classes share the same namespace.

Is there a workaround so I do not end up with something like this:

using Example
namespace Example
{
  .............
}

paulourada

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Namespace issue
« Reply #1 on: May 02, 2007, 10:58:08 am »
I have a similar issue in C++ codegen.  The %fileHeader% macro always adds the using statements.  I put the following code at the beginning of the C++ File Impl codegen template:

Code: [Select]

$COMMENT="Remove the using statement from the headers"
$headers=%fileHeaders%
$usingIdx = %FIND($headers, "using")%
%if $usingIdx != "0" and $usingIdx != "-1"%
$headers=%LEFT($headers, $usingIdx)%
%endIf%


And then commented out the ImportSectionImpl under the "WARNING" section.

Code: [Select]

$COMMENT="WARNING: DO NOT MODIFY THIS TEMPLATE BELOW THIS POINT"
$COMMENT="Do not use ImportSectionImpl as it causes a using statment to be generated"
$COMMENT="%ImportSectionImpl%"
$headers


Hope this helps!

Paul