I try to implement some application in DDD manner with CQRS. I use asp.net core application, and as well as Microsofts (in the microservices book) I use Mediatr. I want to implement filtering of articles. For that purpose, people advise to use Specification pattern and store all specifications in Domain (What layer should contain Queries in DDD).
But if I use dapper, how can I deal with parsing expressions? With EF it's not a problem, but with raw SQL it is. I don't think it is worth to implement Expression tree parser and converter to SQL. It is simpler just store some FilterModel in Domain, and build SQL or SphinxQl by traversing that model in infrastructure model. Is that solution will fit with DDD principles? I will appreciate for advice)