views:

2019

answers:

3

Currently I'm exploring my way through all the new features added to the Visual Studio 2010 Beta 1 IDE and I found a feature that will hopefully be of great help to me. The UML Modeling tool in the Architecture Edition. I wanted to create a new test project, nothing special. I started out with creating just a standard UML Logical Class Diagram. Then after I had finished I wanted to export my diagram to C# code with class stubs but I couldn't figure out how to do it. So naturally I consulted MSDN, but I couldn't find any reference to the top down approach of design and sort of gave up on it. Then I happened to be on the Channel 9 website and I watch the Top down architecture video and they alluded to the possibility of Visual Studio 2010 being able to accomplish this task.

So I guess my question is, can Visual Studio 2010 take a Logical Class Diagram and generate code stubs from it?

I'm currently using Visual Studio 2010 Beta 1 Team System on Windows 7 (if that helps any).

Thank you

+1  A: 

According to MSFT, the answer is no. Or at least, it is not built in by default though may be delivered by extension. See here

Jason Irwin
+4  A: 

Try the following topics from the RC docs:

  • How to: Generate Files from a UML Model

    From a UML model, you can generate program code, schemas, documents, resources, and other artifacts of any kind. One convenient method of generating text files from a UML model is to use text templates. These let you embed program code inside the text that you want to generate.

  • Customizing Your Model with Profiles and Stereotypes

    You can adapt the standard UML model elements, such as classes and components, to customize them for specific purposes. You can apply a stereotype to a model element that can change the element's list of properties. Stereotypes are defined within collections called profiles.

You might also check out this blog post by Tim Fischer helps: "How To: Generate Code from Team System UML Diagrams in VS 2010 Team System Beta 2 (Update 4)"

Here is the first code-snippet about how to generate code from UML-Diagrams using T4 Text-Templates.alt text

Here's another blog post by Oleg Sych: UML Modeling and Code Generation in Visual Studio 2010

Assuming that reader is already familiar with UML, it focuses on custom UML profiles - an extensibility mechanism that can be used to tailor UML models to a particular problem domain. Readers will see an example of such a profile, which extends UML Class Diagrams for database modeling. Finally, the article shows how code can be generated from UML models using T4 text templates.

I've posted more links on my profile for more info.

Esther Fan - MSFT
@Esther: BTW, it's also preferred to leave signatures on the profile pages. Thanks.
John Saunders
@John: OK, thanks! Should I also replace the URLs with the page titles?
Esther Fan - MSFT
@Esther: if you like. What I did on the other answer was use the short URL to find the page (other tab), then come to this one, edit, copy the title over, select the title, click the little "world" icon in the toolbar, and paste in the URL. And thanks again. SO is a unique site and can take some getting used to. See http://stackoverflow.com/faq when you get a chance.
John Saunders
+2  A: 

You answer is Visualization and Modeling Feature Pack. This pack gives your what ever you need regarding code generation from Visual Studio 2010 modeling facilities and more.

afsharm