Ends in:
7 DAYS
20 HRS
8 MIN
57 SEC
Ends in:
7 D
20 H
8 M
57 S
Open Closed

Clarification on Combining Controller and Application Service in ABP Framework #7831


User avatar
0
nhontran created
  • ABP Framework version: v8.0.2
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Auth Server Separated (for Angular): yes

I am working with the ABP Framework, and I came across a pattern in the code where a controller class is implementing an application service interface, as shown below:

Could you kindly clarify the reasoning behind this pattern? Specifically, why would a controller implement an application service interface, as it seems to merge the concerns of both the controller and the service layer into one class?

I understand that typically the application service encapsulates the business logic, while the controller handles the HTTP requests. Is this an intended pattern in certain scenarios within ABP, and what would be the advantages or trade-offs of using it compared to the more common separation of concerns?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    The web layer in your/built-in module will use the application service interface. The web layer in a tiered project or microservice does not depend on the application service layer.

    This HTTP.API layer acts as the implementation of the application service interface.

    https://abp.io/docs/latest/solution-templates/layered-web-application#tiered-structure https://abp.io/docs/latest/framework/api-development/dynamic-csharp-clients https://abp.io/docs/latest/framework/api-development/static-csharp-clients

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06