[英]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,但不明显的是它传入的泛型类型参数,即:
Activity
和int
。
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.