Generating class code from VS2010 UML class diagram within a non-modelling project
I am trying to write some T4 templates to generate basic class definitions from my physical UML class diagram that lives in my domain project. However, all of the T4 examples I have seen on the web for generating code from UML class diagrams are based on modeling projects (.modelproj). Is it possible to use T4 templates to examine and generate code for UML class diagrams that ARE NOT within a VS2010 modeling project? I cannot use use class diagrams in a modeling project as they are logical and hence any class properties are restricted to four primitive types.
There are 2 kinds of Visual Studio class diagram: the UML .classdiagram files that can only be opened in a .modelproj project; and the .NET class diagrams that you can get from a code file using the "View Class Diagram" command in Solution Explorer. I'm not quite clear which one you're working with, since if you've got the latter kind, you'd already have some code.
BTW, you can actually use properties of any type in a UML class diagram. In the model explorer, right-click to get the shortcut menu on the root node, and choose Add External Type. You can enter any namespace and type name. Then that type appears in the menu for setting the types of class properties.