I need some help and guidance in data transformations between my DTOs and Models (to be written in .Net Core). This will be a read only API.
I have a TaskDTO and a TaskModel.
The TaskDTO has several enums for Status, but TaskModel has only one enum Status property that will be set according to the TaskDto's several enums. So there is some data transformation logic.
My question: Which design pattern is preferable for that and where SHOULD this data transformation logic happen?
I have used Automappers in the past and it was problematic PLUS it's not a complicated API service, that would require dozens of mappers.
I'm thinking to create handlers and write my own "mappers". So the API controllers would only need to use the handlers and return responses. Inside these handlers i.e IGetHandler, I would put the data transformation logic.
How does it sound?
Thanks
Aucun commentaire:
Enregistrer un commentaire