Closed rwxzig closed 6 months ago
In a clean architecture setup, it is generally recommended to place business logic, such as custom managers, in the application layer. The application layer is the layer responsible for coordinating the use of the other layers, and it is the place where you can implement use cases or business logic that span multiple entities or interact with multiple external resources.
One option for implementing custom managers for the api/customers endpoint would be to create a class in the application layer called something like CustomersManager or GetCustomersUseCase, and to define methods in this class that handle the logic for fetching and returning customers from the database or other persistence layer. You could then call these methods from within a controller class in the presentation layer, which is responsible for handling HTTP requests and responses.
It is important to keep the application layer free of dependencies on frameworks and external libraries, so you should aim to inject any dependencies that the CustomersManager or GetCustomersUseCase class needs as constructor parameters. This will help to make the application layer easy to test and maintain, and will also make it easier to change the implementation of the api/customers endpoint without affecting the rest of the application.
for example, 1 create a customer controller in the "blazor.server.ui" project. 2 create getall method send GetAllCustomersQuery via MediatR.
Is there any specific place where you would put a Custom Manager for a certain api endpoint. Suppose that I have an api
api/customers
and I want to return all customers, where would make more sense to put the custom managers, so it wont violate the clean architecture principles?