Context
Currently I\'m working in a Documents and Records Management System (DRMS?). Because of some technical limitations I need to store a \"view\
The AppServices doesn't need is related with yours entities. The AppServices can be a one functional needs, that way there can be a UploadAppServices where there will create two entities.
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.
Ideally, an AppService should not call another AppService.
An application service should map Data Transfer Objects (DTOs) to Domain Objects (entities), apply application logic and pass these to the respective Domain Manager(s) for persistence.
It is perfectly alright to inject multiple managers, especially if mappings are configured properly. Where possible, an application service should not need to depend on another application service.
Realistically, an application service may provide convenience (and speed due to fewer server calls) by accepting nested "secondary" DTOs. These DTOs may involve separate application logic.
One way to do this cleanly is to create internal
methods in the dependency application service, e.g. CreateInternal
for a Create
method. The internal
methods are not converted to the dynamic Web API methods and avoid overhead of authorization and validation by interceptors.
Additionally, the ABP framework offers the [RemoteService(IsEnabled = false)]
attribute if you want to call these methods directly from an MVC Controller — so the methods need to be public.