c# - 使用 Visual Studio 2010 UML 建模的代码 stub

标签 c# visual-studio-2010 code-generation uml

目前,我正在探索添加到 Visual Studio 2010 Beta 1 IDE 中的所有新功能,我发现了一个有望对我有很大帮助的功能。 Architecture Edition 中的 UML 建模工具。我想创建一个新的测试项目,没什么特别的。我开始只是创建一个标准的 UML 逻辑类图。完成后,我想将我的图表导出为带有类 stub 的 C# 代码,但我不知道该怎么做。所以我自然而然地咨询了 MSDN,但我找不到任何关于自上而下的设计方法的引用资料,所以我放弃了它。然后我碰巧在第 9 channel 的网站上观看了自上而下的体系结构视频,他们提到了 Visual Studio 2010 能够完成此任务的可能性。

所以我想我的问题是,Visual Studio 2010 可以采用逻辑类图并从中生成代码 stub 吗?

我目前在 Windows 7 上使用 Visual Studio 2010 Beta 1 Team System(如果有帮助的话)。

谢谢

最佳答案

尝试 RC 文档中的以下主题:

  • 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.

您还可以查看 Tim Fischer 帮助的这篇博客文章:“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
(source: msdn.com)

这是 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.

我在 my profile 上发布了更多链接了解更多信息。

关于c# - 使用 Visual Studio 2010 UML 建模的代码 stub ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1269414/

相关文章:

c# - ajax beginForm 传递路由值和按钮值

windows - 一个应用程序的推荐解决方案,让一个应用程序拥有可以被同一台机器的多个用户共享的设置文件

windows - 卸载后安装 Visual Studio 2010 Service Pack 1 时出现问题

Symfony 学说 :generate:entities How to find is and has methods

database - 从对象定义生成数据库表

c# - List<T> 怎么没有实现 Add(object value)?

c# - 每个单词的第一个字母大写

c# - HTTPClient 错误提供了无效的请求 URI

wpf - Visual Studio 2010 : What is a . pfk 文件?

c# - 通过委托(delegate)生成接口(interface)实现的工具?