Applying the CQRS design pattern
CQRS is a microservice design pattern responsible for segregating query transactions (reads) from the insert, update, and delete operations (writes). The separation of these two groups lessens the cohesion access to these transactions, which provides less traffic and faster performance, especially when the application becomes complex. Moreover, this design pattern creates a loose-coupling feature between the API services and the repository layer, which gives us an advantage if there are several turnovers and changes in the repository layers.
Defining the handler interfaces
To pursue CQRS, we need to create the two interfaces that define the query and the command transactions. The following code shows the interfaces that will identify the read and write transactions for Profile_Trainers
:
class IQueryHandler: pass class ICommandHandler: pass
Here, IQueryHandler
and ICommandHandler
are informal...