Book a Demo

Author Topic: Spaces in NameSpaces  (Read 2614 times)

MarkDowell

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Spaces in NameSpaces
« on: January 21, 2004, 02:17:14 am »
Hi All, sorry if this question has been asked before, I have done a search throught the forum but couldn't find an answer.
I'm currently toying with the EAExample project, specifically with regards to code generation in C#.  When I generate the code for the Message Class it is given a NameSpace based on it's location in the project view. i.e. Model Views.Business Context Model.Business Model.Domain Model.Messages.
The first problem here is that there are a number of spaces in this namespace can these be removed?
Secondly, this is not the namespace I would want, do I have to structure my model heirarchy the way I want my NameSpace?

I was hoping that I could put a group of classes in any namespace I wish. e.g. CompanyName.System.Subsystem.Project

Hope this is makes sense.
« Last Edit: January 21, 2004, 02:19:31 am by MarkDowell »

fluxtah

  • EA User
  • **
  • Posts: 144
  • Karma: +0/-0
    • View Profile
Re: Spaces in NameSpaces
« Reply #1 on: January 31, 2004, 03:29:53 pm »
Hiya,

It does seem that EA will create a namespace path based on the tree structure of the packages from a View downwards.

I am developing my software in c#, I have an imported .NET framework model that resides in a Project root node called NET Framework and inside is a  view entitled System, in this view I have folders, Web, Data, Windows, etc

When I make a new project I will create a new project root node - My Project
in this I will create a view which will be my root name space, ie: MySystem
then from there I can create more packages, classes etc, i could create a package called Data within MySystem and the namespace in my forward engineer will become MySystem.Data

Also on export any class relationships I make from the NET framework model will be included in the export as namespace references ie- using System.Web if I associate a class from package System.Web.

This way you could have several system models as long as there root package is a view, when you make a new project root node and start modelling a system referencing objects from other systems they will all be considering in the forward engineering of c# code.
I think there is a way to set namespaces but I am not really sure how these work yet.

I hope I haven't given you a long winded answer to your question, however I have been playing with the fwd/rev engineering of c# code with EA and I am finding a few probs, one of the first was yours :]

I think all this does apply to low-level modelling only when building a blueprint of a system, in UML at high-level (to my newbie understanding) means you can have packages with spaces in them such as 'Business Process Model' as these models are used to describe the system but not define a blue-print of the system that is suitable for fwd/eng.

- Fluxtah
« Last Edit: January 31, 2004, 03:30:26 pm by fluxtah »