Book a Demo

Author Topic: VBNet Namespace and Import Section Code Generation  (Read 4594 times)

Roland Tucker

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
VBNet Namespace and Import Section Code Generation
« on: August 10, 2010, 12:50:13 pm »
There is an inconsistency in path names between namespaces and the import section ("fileImports" macro) when generating VBNet code.

When generating VBNet code, the namespace path starts from the first child package after a root package (i.e. package set as namespace root).
But, in the dependencies derived from associations of the Import Section (i.e. fileImports field subst. macro), the path of any packages starts with the root package name.

For example:
Here is the structure of our packages:
Developers (i.e. root Model/Project)
   - Main (i.e. namespace root)
      - ClientName
         - AppName
            - BusinessModel
            - Client
            - DataAccess
            - DataStore
            - Service

The dependencies derived from associations in the imports section will generate as:
"Main.ClientName.AppName.BusinessModel"
This is not what was expected and causes errors in our code.

Whereas the class namespaces will generate as:
"ClientName.AppName.BusinessModel"
This is what would be expected.

As a comparison, in C# code generation, the namespace and import section paths always start with the child package beneath the root package.  For example (from above), they always generate as "ClientName.AppName.BusinessModel"

Any suggestions would be welcome.   Anything from changing our models to fixing code generation templates to changing EA options/settings.

Thanks

Roland Tucker

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: VBNet Namespace and Import Section Code Genera
« Reply #1 on: August 24, 2010, 03:46:30 pm »
If anyone is interested, I worked around this issue by using full namespace when referencing objects (e.g. instead of " Customer", used "ClientName.AppName.BusinessModel.Customer").  This didn't solve all the issues though.

So I also added code to VBNet Code Generation templates to remove the root namespace package name.  I.e.
Code: [Select]
%REPLACE($imports, " Main.", " ")%, where "$imports" contains all the class import statements.

 ;)