【发布时间】:2017-07-04 00:32:00
【问题描述】:
我正在尝试按照以下模式遵循 DDD。
Controller-----DataContract----> Domain Layer (DDD)
Controller-----Domain Object---> Repository---Entity--->EntityFramework
正如您在上图中看到的,域层 是独立做出业务决策的,但在我的例子中,大多数业务决策都是即时做出的。例如,
if(Account Number Associated?)
Load CustomerDetails //A database call is needed
....
.....
if(Has customer another loan)
.....
.....
Load other loan details //A database call is needed
.....
.....
if(Was that repaid?)
....
....
Load collateral details //A database call is needed
.....
.....
Calculate collateral details and return.
else
Load other data //A database call is needed
else
Load other data //A database call is needed
else
Load other data //A database call is needed
正如您在上面的示例中看到的那样,应用程序通过调用数据库来动态做出许多业务决策。由于 Domain Layer 不应该依赖于 Repository Layer,我不知道如何进行。
我可能会使用应用程序服务进行数据库调用,但是域层不会有任何逻辑。所有逻辑都将进入应用程序服务。
请帮帮我。
-盘点
【问题讨论】:
标签: domain-driven-design ddd-repositories