The ability to add custom functionality to a single repository is a useful feature when the added functionality is related only to a single entity. In this section, we will investigate how this can be done, and move the pagination and search logic from the service layer to the repository layer.
If we want to add custom functionality to a single repository, we have to follow the following steps:
Create a custom interface that declares the custom methods.
Implement the created interface.
Create a repository interface.
Create a service implementation that uses the custom functionality.
Our first step is to create an interface that declares the custom repository methods. Since our goal is to move the pagination and search logic to the repository layer, we have to add the following methods to the created interface:
Returns all contacts...