you can just read the summary no need to read all the lines
Summary :
(DTO) Service | Mapping | (Model) => Repo (Model) => DB
DB (Model) => Repo (Model) => (Model) | Mapping | Service (DTO)
The mapping is not done on the DB ! uncessary data was retrived ?, how to solve that ?
I’ve been looking for days about that, I’m still learning as we all are.. but I’ve a question
Mapping a model into a view model,
Team A : make a method in your service that returns DTO,
Team B : make service return the model and map it in controller so if there are multiple views u dont have to add multiple functions in the service.
Ok but both approaches i get Model from the repository and map it whops !!! right there
i get MODEL FROM THE REPOSITORY and then map it to the DTO which means im mapping it on the server i’ve already got the model or the list of it from the data base and mapping it would be a load on the backend server which means I’ve already got some uncessary data from the DB
As we all know that is according to the rules they say :v, repo shall take model and return model
and by that the mapping is done wrong or what ?
I expected to map within the db but that breaks the whole thing of Repository pattern
because we supposed to give model and take model from repo layer
and map within whatever outer layer