I have a project and I follow Repository and UoW patterns. I also have a "service" layer which I also use as my BL layer.
Taking for example a Customer domain model, I might have information that I need to retrieve along with the customer, so in the customer repository class I have the following methods:
public CustomerModel Get(int id); public IEnumerable<CustomerAddressModel> GetAddresses(int id); public IEnumerable<CustomerOrderModel> GetOrders(int id);
The above methods make a standard db call in the relevant tables and are called by the service class.
Now I have additional methods that I need to the customer, such as:
public bool HasReminders(int id); public bool ForwardedToDebtCollection(int id); //etc...
These methods do not have specific tables but make a db call to different the relevant views.
I would like to keep db-specific code (especially SQL statements) within the repository layer. This is also because the service layer does not have references to EntityFramework and Dapper. These are solely used in the repository layer.
Should I add the additional methods to the repository layer and let the service layer call these methods, or should they be placed directly in the service layer as they are part of the business logic?