Should I be calling an AppService from another AppService?

后端 未结 3 1151
-上瘾入骨i
-上瘾入骨i 2020-12-21 09:27

Context

Currently I\'m working in a Documents and Records Management System (DRMS?). Because of some technical limitations I need to store a \"view\

3条回答
  •  一向
    一向 (楼主)
    2020-12-21 09:50

    I don't suggest to call an application service from another service in the same domain. Application services are designed to be called from UI layer. It implements audit logging, authorization, validation... and they will not probably needed if you use a code in the same application layer.

    An application service method is a public endpoint of your application. Calling an application service from another is like going out of your application and entering from a different point. You also probably don't want to change an application service method if another application service method's signature changes (because of a requirement change in UI).

    My suggestion is to seperate the shared code into another class (probably a domain service) and use from both application services.

提交回复
热议问题