Visual Studio UML类图&通用类型的建模 [英] Visual Studio UML Class Diagram & Modeling of Generic Types

查看:263
本文介绍了Visual Studio UML类图&通用类型的建模的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要对继承自基本泛型类的具体泛型类进行建模.首先,请参见下文:

I need to model a concrete generic class inheriting from a base generic class. First, see below:

ActivityFacade应该以这种方式实现:

ActivityFacade should be implemented this way:

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

如何在VS2012 UML类图中对此建模?从图中可以明显看出,ActivityFacade是从BaseFacade继承的,但是不明显的是它传入的通用类型参数:Activityint.

How can I model this in a VS2012 UML class diagram? 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.

推荐答案

您需要添加新的绑定类(BaseFacade <Activity, int>),并使用模板绑定连接器,然后从绑定类中专门化您的子类(ActivityFacade).

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.

根据OMG UML规范

From the OMG UML specification

模板是一个参数化元素...用于使用TemplateBinding关系生成其他模型元素.模板签名的模板参数指定形式参数,该形式参数将由绑定中的实际参数(或默认值)替换. "

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

更新:

我包含的图是使用EA绘制的.可以在Visual Studio UML工具中对相同的概念进行建模.请参阅"模板类型:使用模板类型(在msdn中.

The diagram I included is drawn using EA. The same concept can be modeled in Visual Studio UML tool. See the section "Template types: To use a template type" in msdn.

这篇关于Visual Studio UML类图&amp;通用类型的建模的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆