Problem
Currently, controllers directly depend on application services, which tightly couples the API layer with business logic. As the codebase grows, this can make the application harder to maintain, test, and extend.
Proposal
Introduce MediatR as a mediator layer between controllers and business logic.
Controllers would delegate requests to MediatR commands/queries instead of calling services directly.
Benefits
- Improved separation of concerns
- Better testability of business logic
- Clearer request/response flow (CQRS-friendly)
- Easier introduction of cross-cutting concerns (logging, validation, transactions)
Scope
- Incremental adoption (start with a single endpoint)
- No breaking changes
- Existing services will remain intact initially
If this approach sounds acceptable, I can prepare a small, focused PR demonstrating the pattern on one controller action.
Problem
Currently, controllers directly depend on application services, which tightly couples the API layer with business logic. As the codebase grows, this can make the application harder to maintain, test, and extend.
Proposal
Introduce MediatR as a mediator layer between controllers and business logic.
Controllers would delegate requests to MediatR commands/queries instead of calling services directly.
Benefits
Scope
If this approach sounds acceptable, I can prepare a small, focused PR demonstrating the pattern on one controller action.