Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: johnp on February 06, 2007, 08:26:13 am
-
How do I get namespace declarations to be generated in my C# classes. I have defined a 'namespace root' at the top level package, but none of the classes inside it have any namespace definitions. What else do I need to do to get this to work please?
Also, what about 'using' statements for namespaces referenced in the class?
-
You might need to put your class below the package that's set as the namespace root.
Try searching the forum for some hints. There's been some discussion about this, but I don't know how much was specific to C# (or even .Net).
-
A namespace root means that the package represents the root namespace. Therefore it will not result in the generation of a namespace.
It is the packages underneath the namespace root package that represent namespaces. So try clearing you namespaces roots for all packages that you want namespaces for.
-
It seems that, because I had embedded spaces in my package names, this was preventing the namespace generation from working (packagePath was a blank string) ;D.
-
Report this as a but to Sparx, in case it does not get picked up from this (user) forum.
Click the Support link at the top of the forum page and then the Bug Report link on the left-side menu.
-
It seems that, because I had embedded spaces in my package names, this was preventing the namespace generation from working (packagePath was a blank string) ;D.
This has been done deliberately because of the number of people that had problems with EA generating invalid code because of namespaces with spaces in the name.
-
This has been done deliberately because of the number of people that had problems with EA generating invalid code because of namespaces with spaces in the name.
That sounds pretty reasonable to me Simon.
Is there any way to warn users about spaces in a name, similar to the way class names are handled? Or would that just move the problem around without solving it?
David