I am developing an application with Clean Architecture and I came across a problem with the structuring and location of some Objects.
In my Application layer, I am using the CQRS approach. In one of my Querys I need to perform a join between two tables. Before I was making the request to the Database directly in my QueryHandler using Dapper, so I created a ViewModel for that. However, I decided to refactor and follow SOLID principles and make the call at the Infrastructure layer. As a result, I came across a problem: the infrastructure layer does not have access to my ViewModel, as it is in the Application Layer.
In other words, my question is: where should I create the resulting object? At the Domain layer? Is there any standard for this type of Object (JOINs Result)?
I have already tried to create an Object in my Entities Folder in the Domain layer, but apparently, it does not seem to be correct, as it is not a Database entity, but rather a result of a JOIN.
André Vítor Pereira Cini is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Your infrastructure layer can reference the application layer, but not the other way around.