在 UML 序列图中显示对象创建(从 DAL)

发布于 2024-07-23 10:28:00 字数 167 浏览 7 评论 0原文

我有 3 个类:控制器、DAL 和实体。 控制器调用 DAL 请求实体。 DAL 从数据库中检索实体数据并创建一个新的实体类,然后将其返回到控制器。 如何在 UML 序列图上显示这一点(无需显示 DB)?

第二个问题:我们应该如何在SO上共享UML图? :)

提前致谢

I have 3 classes: Controller, DAL and Entity. The controller calls the DAL requesting an Entity. The DAL retrieves the entity data from the DB and creates a new Entity class which is then returned to the Controller. How do I show this on a UML sequece chart (no need to show the DB)?

2nd question: how should we share UML diagrams on SO? :)

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟织青萝梦 2024-07-30 10:28:00
   Controller       DAL               DB
        |            |                 |
        | get entity |                 |
        |----------->| get entity data |
        |            |---------------->|
        |            |< - - - - - - - -|
        |            |                 |
        |            |--               |
        |            |  |create entity |
        |            |<-               |
        |<- - - - - -|                 |

注意:“创建实体”是一个“自消息”,因此它从 DAL 的生命线开始并返回到 DAL 的生命线。 我只是无法用人物来画得更好。 转发消息为实线,回复消息为虚线。

编辑:反思评论,如果重要的话,您还可以显示实体的生命线。

   Controller       DAL               DB
        |            |                 |
        | get entity |                 |
        |----------->| get entity data |
        |            |---------------->|
        |            |< - - - - - - - -|
        |            |                 |
        |   entity   |---->Entity      |
        |<- - - - - -|       |         |
        |            |       |         |

如果您还想显示对实体的其他调用,它会很有用。

   Controller       DAL               DB
        |            |                 |
        | get entity |                 |
        |----------->| get entity data |
        |            |---------------->|
        |            |< - - - - - - - -|
        |            |                 |
        |            |--               |
        |            |  |create entity |
        |            |<-               |
        |<- - - - - -|                 |

note: "Create entity" is a "self-message", so it starts from DAL's lifeline and goes back into DAL's lifeline. I just can't draw it better with characters. Forward messages are continous line, reply messages are dashed line.

EDIT: reflecting on comment, you can also show Entity's lifeline, if it's important.

   Controller       DAL               DB
        |            |                 |
        | get entity |                 |
        |----------->| get entity data |
        |            |---------------->|
        |            |< - - - - - - - -|
        |            |                 |
        |   entity   |---->Entity      |
        |<- - - - - -|       |         |
        |            |       |         |

It's useful if you want to show other calls to Entity as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文