Conversion Between DTO and Entity Classes in Scala
Sep 9, 2019 · 1 minute read · CommentsWhen you practicing DDD (Domain-Driven-Design), you need to create different bounded countexts, for example when you receive DTO object PersonDTO
, It should be mapped to PersonEntity
. This conversion, have lots of repetitive works to copy fields of one object to another.
In scala there is type-safa data transoformer chimney which can do it for you with macros and providing simple dsl for it.
Scala-Automapper is another library which is similar to chimney
but when you have some difference in fields type, you can’t do it, easily like chimney