Book a Demo

Author Topic: changing namespace  (Read 2953 times)

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
changing namespace
« on: May 09, 2007, 01:51:42 am »
Hello,

we try to find an easy way to change the namespace of already generated c# classes.

What currently happes is, when we move the package A containing the class C into another package as a new subpackage and regenerate code, the namespace of C stays unchanged.

if we move the class C into another namespace and regenerate
code, a new (empty bodies) class is generated.

When we change the namespace in the c# code from
e.g.

namespace A into namespace B.A
and reverse engineer it, the namespace changing is NOT reflected in the model.

Generating the code now, creates a new (empty bodies) class C with the old namespace.

So what is the way to properly change the namespace?

Regards
Michael

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: changing namespace
« Reply #1 on: May 09, 2007, 01:17:34 pm »
EA doesn't refactor classes into new namespaces when generating.  As a result the easiest way to change the namespace is to change it in code and reverse engineer the source directory.  (Package per namespace, as this updates the package of all reverse engineered classes)

Alternatively, the automation interface provides a method to do the same thing as the source directory import on a file basis, and MDG Integration for VS 2005 has an option that automatically updates the class when saved in VS.  As a result if you change the namespace in VS with this option set the class in EA will automatically be moved into the new package.