开发者

Is it possible to omit namespaces in VS 2010 Ultimate UML Editor?

when designing UML models in Visual Studio 2010 Ultimate (with Visualization and Modeling Feature Pack 1) I always need to indicate the full Type name (including the namespace) in order to get code that compiles (when doing 'Generate Code...'). Is there a way to "import" namespaces into the model? I can 'Add Refe开发者_StackOverflow中文版rence...' on the Modelling Project, but this won't work because VS puts it as a Layer Reference (which is something else unfortunately).

Being forced to indicate the whole namespace makes the UML diagrams really hard to read... Imagine this being one line in an UML class model:

+ GetTexture(device : Microsoft.Xna.Framework.Graphics.GraphicsDevice) : Microsoft.Xna.Framework.Graphics.Texture2D

Thanks for your help!


I figured out it is possible, though not really the best idea.

Open Architecture -> Windows -> UML Model Explorer. Right click on "Modelling" and select "Properties". Expand Stereotypes -> C# namespace and enter all namespaces you wish to have reference in the generated code files ("using ...") under "Using namespace" as a semi-colon separated list.

The better way to do it is described in this post. The reason is that in this case the type is for sure the one you selected and clashes (with other types from other namespaces in the generated code file) cannot occur.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜