Book a Demo

Author Topic: VBNet namespaces  (Read 2004 times)

jon_m

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
VBNet namespaces
« on: March 01, 2005, 09:36:58 am »
Hi, I'm fairly new to using EA and have been trying to use the code generation today for the first time.  I ran into a problem concerning namespaces, I wonder if anybody can help me with it:

Basically I have a model with classes divided into multiple packages with associations between them.  Code generation produces class declarations similar to the following:

Namespace Package1
 Class Class 1
   ....
 End Class
End Namespace

Which is fine, this creates the class: Project1.Package1.Class1

If this class is associated with a class in another package, say Package2.Class2, code generation adds an Import statement to the above:

Imports Package2.Class2

Which causes an error, the compiler is looking for:

Imports Project1.Package2.Class2

If I create a package in EA called Project1 and put all the packages under it, then the code comes out more like:

Imports Project1.Package2.Class2

Namespace Project1.Package1
 Class Class 1
   ....
 End Class
End Namespace

Which causes the same problem because the classes get created as:

Project1.Project1.PackageX.ClassX

Which renders the Import statement incorrect.

Does anybody know of a way around this?  I have been looking at the Code Generation templates as a possible way to change the behaviour but if there is an easier way I would love to hear it!  Thanks very much

Jon