Book a Demo

Author Topic: Using statement  (Read 2686 times)

JMichelson

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Using statement
« on: February 02, 2004, 07:29:54 pm »
In my C# class, I've added some types through the Class | Attributes AE function (i.e. private AcctObj _accObj = ...) wherein the Type definition (in this case AcctObj) comes from another asembly, which also appears in the EA model - - in fact, I selected the Type from the selection list.  The problem is, the generated C# code for the class does not automatically insert the "using..." statement that contains the Type definition.  This seems like a "no-brainer" to me, so I must be doing something wrong.

Any suggestions?  Thanks!  Jeff

fluxtah

  • EA User
  • **
  • Posts: 144
  • Karma: +0/-0
    • View Profile
Re: Using statement
« Reply #1 on: February 02, 2004, 07:52:56 pm »
hiya,

I am new to EA myself, but as it seems the code generation will pick up referenced assemblies by using packages as namespacing paths.

It seems to me that namespacing is determined by packages from a view package downward, ie:-

if you put your type in a view called MyAssembly

and your other class out of this view, in another view say called MySystem

when you forward engineer a class that is in MySystem the namespace reference using MyAssembly should appear in the code generation.

There is a way to actually set the namespace root, not sure how this works yet though, maybe someone can enlighten us? :]

« Last Edit: February 02, 2004, 07:54:02 pm by fluxtah »

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: Using statement
« Reply #2 on: February 10, 2004, 07:14:19 pm »
Hi Jeff and Fluxtah,

In regard to your queries:

Quote
The problem is, the generated C# code for the class does not automatically insert the "using..." statement that contains the Type definition

This is a limitation of the current version of EA- using statements are only inserted for classifiers that are linked to the generated class via an association/ aggregation/generalization/realization connector.

We will certainly look at analysing the class features for additional classifiers, in future releases of EA.

Quote
There is a way to actually set the namespace root, not sure how this works yet though, maybe someone can enlighten us? :]

1. Right-click a package in the Project View
2. Select Package Control | Set Namespace as Root

Regards,
Ben