简体   繁体   English

使用Visual Studio 2010 UML建模进行代码存根

[英]Code stubbing with Visual Studio 2010 UML modeling

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. 目前,我正在探索添加到Visual Studio 2010 Beta 1 IDE中的所有新功能,我发现了一个功能,希望对我有很大的帮助。 The UML Modeling tool in the Architecture Edition. Architecture Edition中的UML建模工具。 I wanted to create a new test project, nothing special. 我想创建一个新的测试项目,没什么特别的。 I started out with creating just a standard UML Logical Class Diagram. 我开始只创建一个标准的UML逻辑类图。 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. 在我完成之后,我想将我的图表导出到带有类存根的C#代码,但我无法弄清楚如何做到这一点。 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. 所以很自然地我咨询了MSDN,但我找不到任何关于自上而下的设计方法的参考,并放弃了它。 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. 然后我碰巧在第9频道的网站上看了自上而下的架构视频,他们提到了Visual Studio 2010能够完成这项任务的可能性。

So I guess my question is, can Visual Studio 2010 take a Logical Class Diagram and generate code stubs from it? 所以我想我的问题是,Visual Studio 2010可以采用逻辑类图并从中生成代码存根吗?

I'm currently using Visual Studio 2010 Beta 1 Team System on Windows 7 (if that helps any). 我目前正在Windows 7上使用Visual Studio 2010 Beta 1 Team System(如果有帮助的话)。

Thank you 谢谢

Try the following topics from the RC docs: 请尝试RC文档中的以下主题:

  • How to: Generate Files from a UML Model 如何:从UML模型生成文件

    From a UML model, you can generate program code, schemas, documents, resources, and other artifacts of any kind. 从UML模型中,您可以生成任何类型的程序代码,模式,文档,资源和其他工件。 One convenient method of generating text files from a UML model is to use text templates. 从UML模型生成文本文件的一种方便方法是使用文本模板。 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. 您可以调整标准UML模型元素(例如类和组件),以便为特定目的对其进行自定义。 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) " 您还可以查看Tim Fischer撰写的这篇博客文章:“ 如何:在VS 2010 Team System Beta 2(Update 4)中从团队系统UML图生成代码

Here is the first code-snippet about how to generate code from UML-Diagrams using T4 Text-Templates. 这是关于如何使用T4文本模板从UML-Diagrams生成代码的第一个代码片段。 替代文字
(source: msdn.com ) (来源: msdn.com

Here's another blog post by Oleg Sych: UML Modeling and Code Generation in Visual Studio 2010 这是Oleg Sych撰写的另一篇博客文章: Visual Studio 2010中的UML建模和代码生成

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. 假设读者已经熟悉UML,它专注于自定义UML配置文件 - 一种可扩展性机制,可用于将UML模型定制到特定问题域。 Readers will see an example of such a profile, which extends UML Class Diagrams for database modeling. 读者将看到这样一个配置文件的示例,它扩展了UML类图以进行数据库建模。 Finally, the article shows how code can be generated from UML models using T4 text templates. 最后,本文展示了如何使用T4文本模板从UML模型生成代码。

I've posted more links on my profile for more info. 我在我的个人资料中发布了更多链接以获取更多信息。

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. 此包为您提供有关Visual Studio 2010建模工具中的代码生成所需的一切等等。

According to MSFT, the answer is no. 根据MSFT,答案是否定的。 Or at least, it is not built in by default though may be delivered by extension. 或者至少,默认情况下它不是内置的,但可以通过扩展来传递。 See here 看到这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM