AutoMapper/AutoMapper — Issue #178: DynamicMap should also map child types
Author: SonOfPirate
Created: 2012-03-01 20:47:36+00:00
State: open

In the current version, DynamicMap throws an exception if a map has not been explicitly created for child objects. If DynamicMap is to truly dynamically map, then it should do so for child types.

For example, if I have an Order object that I am mapping to OrderDTO and both have Customer properties (of type Customer and CustomerDTO, respectively), calling Mapper.DynamicMap(...) should not only create a map for Order to OrderDTO but also dynamically create a mapping for Customer to CustomerDTO.

Only in the case when the name of a property on the target cannot be resolved with a name on the source should an exception be thrown. As long as the names can be resolved using the normal conventions, all child objects, grandchildren, and so on should also be dynamically mapped.