流程创建新订单输入 DDD 方式
我是第一次探索领域驱动设计,并牢记一些我想讨论的问题。其中之一是...
我正在设计一个用于订单维护的 Web 应用程序。当用户创建新订单时,系统会打开一个新订单输入屏幕。它将生成一个应用程序编号和一些与订单限制相关的预配置信息(来自数据库),用户必须针对所创建的订单进行选择。
现在我想到的问题......
1. 如何生成这个新的订单输入屏幕,其中包含已生成的申请号以及从 DDD 角度从数据库中提取的一些信息?
2. 我是否必须使用 OrderFactory 创建新订单(填充了 App# 和限制),然后将其转换为 DTO 并将其发送到表示层?
3. 填写必要的详细信息后,当用户提交订单时,应遵循什么流程来保存订单?假设表示层将 OrderDTO 发送到服务层,那么服务层应该做什么?
I'm exploring Domain Driven Design for the first time and stuck with some questions in mind which I would like to discuss. One of them is...
I'm designing a web application for order maintenance. When the user creates a new Order, the system opens up a new order entry screen. It will generates an Application Number and some pre-configured information pertaining to order restrictions (from database) which the user has to select specific to this order being created.
Now the question I have in mind ....
1. How to go about generating this NEW order entry screen with Application Number generated and some information pulled in from database from DDD stand point?
2. Do I have to use an OrderFactory to create a NEW Order (with App# and restrictions populated) and then translate it to DTO and send it across to Presentation Layer?
3. After filling in the necessary details, when user submits the Order, what should be the process to follow to persist it? say presentation layer sends in a OrderDTO to service layer and then service layer should do what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是一个非常小的示例,可以让您对生命周期有一些了解。
请注意,这是一种传统的 DDD 风格,您可能希望将读取模型与写入模型 (CQRS) 分开,并基于 UI 任务。
在表示代码(控制器)中
在服务层(应用程序层)中
The following is a very small sample which can give you a little idea about the lifecycle.
Note that this is sort of traditional DDD style, you may want to separate the read model from the write model (CQRS) and make the UI task based.
In Presentation code (Controller)
In Service Layer (Application Layer)
DDD 的核心是捕获用户意图。因此请提出更多问题,例如
1)用户为什么要创建订单 - 命令
2)用户创建订单后应该发生什么。这对域模型意味着什么——来自域的事件
请查看 CQRS 模式以获取更多信息
DDD is all about capturing the user intention .So put more questions like
1) Why did the user want to create order -- Command
2)what should happen after the user has created the order. what is that mean to the domain model -- Events coming out of domain
please look at CQRS pattern for more info