简体   繁体   English

Visual Studio UML类图和通用类型建模

[英]Visual Studio UML Class Diagram & Modeling of Generic Types

I need to model a concrete generic class inheriting from a base generic class. 我需要建模一个继承自基类泛型类的具体泛型类。 First, see below: 首先,见下文:

在此输入图像描述

ActivityFacade should be implemented this way: ActivityFacade应该以这种方式实现:

public class ActivityFacade : BaseFacade<Activity, int>
{
}

How can I model this in a VS2012 UML class diagram? 如何在VS2012 UML类图中对此进行建模? Looking at the diagram, it is obvious that ActivityFacade inherits from BaseFacade, but what's not obvious is the generic type parameters that it is passing in, namely: Activity and int . 查看图表,很明显ActivityFacade继承自BaseFacade,但不明显的是它传入的泛型类型参数,即: Activityint

You need to add a new binding class ( BaseFacade <Activity, int> ) connect it to your parameterized class ( BaseFacade<T, TKey> ) with a template binding connector and then specialize your child class ( ActivityFacade ) from the binding class. 您需要添加一个新的绑定类BaseFacade <Activity, int> ),使用模板绑定连接器将其连接到参数化类( BaseFacade<T, TKey> ),然后从绑定类中专门化您的子类( ActivityFacade )。

在此输入图像描述

From the OMG UML specification 来自OMG UML规范

"A template is a parameterized element ... used to generate other model elements using TemplateBinding relationships. The template parameters for the template signature specify the formal parameters that will be substituted by actual parameters (or the default) in a binding." “模板是一个参数化元素...用于使用TemplateBinding关系生成其他模型元素。模板签名的模板参数指定将由绑定中的实际参数(或默认值)替换的形式参数。”

UPDATE: 更新:

The diagram I included is drawn using EA. 我包含的图表是使用EA绘制的。 The same concept can be modeled in Visual Studio UML tool. 可以在Visual Studio UML工具中对相同的概念进行建模。 See the section " Template types: To use a template type " in msdn. 请参阅msdn中的“ 模板类型:使用模板类型 ”部分。

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

相关问题 Visual Studio UML类图不显示一般约束 - Visual Studio UML Class Diagram does not show Generic Constraint Visual Studio UML类图生成器 - Visual Studio UML Class Diagram Generator 接口属性不会自动复制到Visual Studio中的UML类图中的类 - Interface attributes not automatically replicated to class in UML class diagram in Visual Studio 在 Visual Studio 2015 UML 类图中生成代码不起作用 - Generate Code in Visual Studio 2015 UML Class diagram is not working 如何在 Visual Studio 2022 中生成序列和 UML 类图? - How to generate sequence and UML class diagram in Visual Studio 2022? 如何在Microsoft Visual Studio中生成项目范围的UML类图 - How to generate project wide UML class diagram in Microsoft Visual Studio 如何在Visual Studio 2013 UML类图设计器中将函数字符串参数的默认值设置为空? - How to set default value of function string parameter to empty in Visual Studio 2013 UML class diagram designer? 在Visual Studio 2010 UML建模图中连接控件 - Connect controls in Visual Studio 2010 UML Modeling Diagrams 如何导出Visual Studio 2010 UML建模图 - How to export Visual Studio 2010 UML Modeling Diagrams 通用参数中的Visual Studio建模和协方差 - Visual Studio Modeling and covariance in generic arguments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM