I'm using Automapper (6.2.1) for convert a hierarchy of Entity objects:
class Entity1 {}
class Entity2 : Entity1 {}
class Entity3 : Entity1 {}
To a corresponding hierarchy of DTO objects:
class EntityDTO1 {}
class EntityDTO2 : EntityDTO1 {}
class EntityDTO3 : EntityDTO1 {}
I have mapped all the convertions like this:
CreateMap<Entity1, EntityDTO1>();
CreateMap<Entity2, EntityDTO2>();
CreateMap<Entity3, EntityDTO3>();
Every time I create one Entity and one DTO i will need to add a new CreateMap
call to my configuration file.
There isn't a more compact method for do this?