If there is Employees repository and I have to get Employee that has a greatest salary - where to put filtering that represents business rule for that?I can get all Employees and filter them out in Domain Model, but that does not seem as efficient as SQL Query in repository. What patterns come into play?
How to avoid business rules in repository?
domain driven design
The business logic is not the query that returns the Employee with the greatest salary -- databases are great at that and you should let the database do that for you via the repository. The business logic is what you do after you retrieve the most highly compensated employee.