Code Generation form Uml Modeling
I have a开发者_如何学编程dded the class to the class diagram in vs 2010 now i want to generate the code from the class diagrams. How can i generate the code in VS2010
From the MSDN article How to: Generate Code from UML Class Diagrams
To generate a separate file for each element
Create a UML model that contains classes. You might want to apply stereotypes to the model elements. For more information, see Default Code Generation Transforms.
On a class diagram or in UML Model Explorer, select elements from which you want to generate code. You can select one of the following: A specific set of elements.
A package or the model, to generate code from its contents. The diagram, to select all the elements on the diagram.
Right-click a selected element, and then click Generate Code.
The first time that you use Generate Code in a particular model, a dialog box appears. This dialog box lets you edit the code generation parameters of the model.
Click OK unless you know that you want to change these parameters.
To return to this dialog box later, right-click the diagram and then click Configure Default Code Generation Settings. For more information, see Customizing the Generate Code Command.
You need one of the Visual Studio 2010 feature packs to enable this functionality. The most recent one is Feature Pack 2, but you also need to have an MSDN Subscription to download it.
精彩评论