Implementing application services
An application service is a stateless class used by the presentation layer to perform use cases of the application. It orchestrates the domain objects to achieve the business operation. Application services get and return DTOs instead of entities.
An application service method is considered a work unit (meaning all database operations—all succeed or all fail as a group, as covered in Chapter 6, Working with the Data Access Infrastructure), which ABP Framework automatically does. A typical flow of an application service method includes the following steps:
- Get the necessary aggregates from the repositories using the input parameters and the current context.
- Implement the use case by coordinating the aggregates, domain services, and other domain objects, and delegating the work to them.
- Update the changed aggregates in the database using the repositories.
- Optionally, return a resulting DTO to the client (typically, to the...