none
Namespaces for class diagram in modelling project? RRS feed

  • Question

  • Hi Folks,

    I have a modeling project with a layer diagram in which I have set namespaces for each layer (the required namespaces property).  Some of the layers contain sub-layers, so I have a parent namespace and child namespaces  eg.  myproj.somelayer  and myproj.somelayer.subcomponent

    I would like to create a class diagram and then associated each class with its appropriate namespace so I can ensure that the class model is validated against the layer diagram.

    I would have just thought it logical to just drag the appropriate interfaces and classes onto the correct locations on the layer diagram so this associate gets created, but that does not appear to be the case and I can see no namespace property in the classes and interfaces that can be set.

    As an experiment I right clicked on the class diagram and chose 'generate code' and got a warning 'There are no template binding configured for code generation at the models root. Would you like to configure these before generating.  Clicking 'Yes' gives me a new dialog but I can find no documentation on what this feature does or how to use it or even if it is relevant to my issue.

    Regards

    Andy

    Tuesday, June 4, 2013 9:23 PM

Answers

  • Hi Andy,

    I don't think there's a way to create a UML class diagram directly from a layer diagram, so that's why I suggested other options.

    Even though layer diagrams are part of a modeling project, I think their elements aren't in UML Model Explorer because layer diagrams aren't UML.

    If you'd like to suggest this capability, feel free to send feedback here or through the feedback tool.

    You can get code maps in the latest update for VS 2012.


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post and mark as Helpful. Thanks!

    Monday, July 8, 2013 11:14 PM

All replies

  • Hi Andy,

    This topic is about generating code from class diagrams:

    How to: Generate Code from UML Class Diagrams 

    You can create layer diagrams directly from code or from dependency diagrams, but not from class diagrams.


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post and mark as Helpful. Thanks!

    Wednesday, June 5, 2013 7:33 PM
  • HI,

    I refer to the following part in my post:

    I would like to create a class diagram and then associated each class with its appropriate namespace so I can ensure that the class model is validated against the layer diagram

    I am wanting to create a class diagram - hence I posted in the class diagram thread (hopefully).

    Sunday, June 23, 2013 11:58 PM
  • I'm sorry I misread your question, Andy.

    If you have Visual Studio 2012, you can get Update 1 or 2.

    You can then create a dependency diagram (code map) with the namespaces and classes (right-click a project in your solution -> Show on Code Map).

    You can then drag from the dependency diagram to the class diagram and to the layer diagram.


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post and mark as Helpful. Thanks!

    Tuesday, July 2, 2013 11:34 PM
  • Hi thanks for you reply.

    Unfortunately I think you may be sill misreading the question.

    I am talking about the Layer Diagram that is part of a modeling project and a UML Class diagram - as far as I am aware there is no Code Map for modeling projects.

    Apart from that...

    I already have the namespaces in the layer diagrams.  A layer diagram can be used to create the overall application code structure (modules and namespaces) of an application or set of applications.

    I want to be able to create the [UML] class diagrams using the namespaces that are already defined in the layer diagrams.

    I DO NOT want to create new namespaces in any other diagram and have to apply them to the layer diagrams.

    What I would reasonably expect...

    To be able to right click a layer in a layer diagram and create a UML diagram of some kind (say Class Diagram or a Component Diagram).

    For layers to show up in the UML Model explorer as tangible items that can be dragged onto a UML diagram.

    Regards

    Andy

    Sunday, July 7, 2013 10:00 PM
  • Hi Andy,

    I don't think there's a way to create a UML class diagram directly from a layer diagram, so that's why I suggested other options.

    Even though layer diagrams are part of a modeling project, I think their elements aren't in UML Model Explorer because layer diagrams aren't UML.

    If you'd like to suggest this capability, feel free to send feedback here or through the feedback tool.

    You can get code maps in the latest update for VS 2012.


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post and mark as Helpful. Thanks!

    Monday, July 8, 2013 11:14 PM