将命名空间工件添加到 Visual Studio 分层图中
Adding Namespace Artifacts to Visual Studio Layering Diagram
我能做什么?
我已经创建了 Visual Studio 建模项目。在项目中,我有一个分层图。在图表中,我可以创建对应于图层的框。使用拖放,我可以将程序集或类型等工件包含到一个层中。然后我可以通过画线来定义层依赖关系,架构验证也可以正常工作。
我想达到什么目的?
根据 msdn article 与层关联的工件不仅可以是程序集或类型,还可以是命名空间:
Layer
A logical group of physical artifacts in your system. These artifacts can be namespaces, projects, classes, methods, and so on.
我希望能够将某个名称空间与工件相关联,以便如果将类型添加到此名称空间,它会自动包含在验证中。此行为适用于程序集,因此显然也适用于命名空间。
到目前为止我尝试了什么?
我还没有设法将命名空间从 class 资源管理器拖放到图层中。我没有找到任何其他方法来做到这一点。尽管如此,层本身还是有命名空间相关的属性。
Forbidden Namespace Dependencies - Specifies that artifacts associated with this layer cannot depend on the specified namespaces.
Forbidden Namespaces - Specifies that artifacts associated with this layer must not belong to the specified namespaces.
Required Namespaces - Specifies that artifacts associated with this layer must belong to one of the specified namespaces.
但是这个属性只是对属于图层的工件施加了一些限制。 None 其中将对应于命名空间的工件关联到图层。
问题:
是否可以将对应于命名空间的工件与 Visual Studio 建模项目的分层图中的层相关联。
最后我自己弄明白了。
答案:
是的,您可以将名称空间用作工件。您可以在任何地方阅读它并在某些网络广播视频中看到,例如Using layer diagrams to design and validate your architecture
我还没有设法从解决方案资源管理器、Class 资源管理器或对象浏览器中完成此操作。仅当您首先通过右键单击解决方案资源管理器中的项目来生成 代码图 时,它才有效。然后导航到所需的命名空间并将命名空间拖放到分层图中。
我能做什么?
我已经创建了 Visual Studio 建模项目。在项目中,我有一个分层图。在图表中,我可以创建对应于图层的框。使用拖放,我可以将程序集或类型等工件包含到一个层中。然后我可以通过画线来定义层依赖关系,架构验证也可以正常工作。
我想达到什么目的?
根据 msdn article 与层关联的工件不仅可以是程序集或类型,还可以是命名空间:
Layer A logical group of physical artifacts in your system. These artifacts can be namespaces, projects, classes, methods, and so on.
我希望能够将某个名称空间与工件相关联,以便如果将类型添加到此名称空间,它会自动包含在验证中。此行为适用于程序集,因此显然也适用于命名空间。
到目前为止我尝试了什么?
我还没有设法将命名空间从 class 资源管理器拖放到图层中。我没有找到任何其他方法来做到这一点。尽管如此,层本身还是有命名空间相关的属性。
Forbidden Namespace Dependencies - Specifies that artifacts associated with this layer cannot depend on the specified namespaces.
Forbidden Namespaces - Specifies that artifacts associated with this layer must not belong to the specified namespaces.
Required Namespaces - Specifies that artifacts associated with this layer must belong to one of the specified namespaces.
但是这个属性只是对属于图层的工件施加了一些限制。 None 其中将对应于命名空间的工件关联到图层。
问题:
是否可以将对应于命名空间的工件与 Visual Studio 建模项目的分层图中的层相关联。
最后我自己弄明白了。
答案: 是的,您可以将名称空间用作工件。您可以在任何地方阅读它并在某些网络广播视频中看到,例如Using layer diagrams to design and validate your architecture
我还没有设法从解决方案资源管理器、Class 资源管理器或对象浏览器中完成此操作。仅当您首先通过右键单击解决方案资源管理器中的项目来生成 代码图 时,它才有效。然后导航到所需的命名空间并将命名空间拖放到分层图中。