vendredi 3 janvier 2020

Mapper pattern in DDD

We have big entity with big number of relations. For now, these relations cannot be refactored.

In some use cases, we have big dto where dependencies from entity are represented as ids. Before saving this entity, I need to convert dto to entity and get all dependencies by id from database. If id of relation in dto is not valid, the validation exception will be sent as result.

Is it fine that mapper have a lot of logic (db requests and validation logic)? what are the possible ways for refactoring?

Aucun commentaire:

Enregistrer un commentaire