在Visual Studio类图上显示依赖关系 [英] Showing the Dependency Relationship on a Visual Studio class diagram

查看:339
本文介绍了在Visual Studio类图上显示依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个这样的类结构:

Say I have a class structure like this:

public interface IFoo
{
}

public class Foo : IFoo
{
}

public class Bar
{
    public void Test(IFoo foo)
}

是否可能显示FooBar之间的关联关系(最弱的关系).我什至应该这样做吗?

Is it possible to show an association relationship between Foo and Bar (the weakest relationship). Should I even be doing this?

推荐答案

正如@Thomas Kilian所说,您的关系(在BarIFoo之间)不是任何类型的关联.可以是依赖关系.

As @Thomas Kilian said your relationship (between Bar and IFoo) is not any types of Association. It can be Dependency relationship.

要了解有关依赖关系的更多信息:
依赖关系是UML关系之一,它位于其他类型依赖项之上.

To have more explaination about Dependency Relationship:
Dependency Relationship is one of UML relationships and it stand on top of other type dependencies.

您的依赖关系是使用类型:使用依赖关系. (请参见参考1 )

Your dependency is type of Usage: use Dependency. (see reference 1)

例如,这可能意味着(客户端)类中的某些方法 使用另一个(供应商)类的对象(例如参数).

For example, it could mean that some method(s) within a (client) class uses objects (e.g. parameters) of the another (supplier) class.



不幸的是,是Visual Studio的类设计器,显示继承和关联.



Unfortunately, Class Designer of Visual Studio, ONLY shows Inheritance and Association.

如果我们要解释这个想法:
依赖关系未显示类之间的卓越情况.有多种类型的依赖项(请参阅参考1 参考2 ),如果是设计师想要显示每种类型的关系,我们的图表将变得混乱.

If we want to explain the idea:
Dependency Relationship did not show remarkable things between classes. There are many types of Dependencies (see reference 1 and reference 2) and if Class Designer wants to show each type of relationship, our diagrams will be so messy.

另一方面,依赖关系主要用于方法论的需求和分析阶段. (并非主要在实施中)

In the other hand, Dependency Relationship mostly use in Requirement and Analysis phase of Methodologies. (not mostly in implementation)

由于这个原因,如果您对代码进行反向工程以使代码的类图在 CASE工具(例如Enterprise Architect),CASE工具不会绘制依存关系.

For this reason, if you reverse engineer your code to have Class Diagram of your code in CASE Tools (like Enterprise Architect), the dependency relationship will not draw by the CASE Tools.

这篇关于在Visual Studio类图上显示依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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