In this part we will use the same OrderDto Object that we had previously but we will let Automapper to map the inner objects.

Once again here is the Domain Objects First

The Dto (Data Transfer Object) look like

This time when we map Order to OrderDto we will also provide the mapping of OrderItems to OrderItemsDto.

As you can see I have taught automapper about its inner child/object mapping before calling Map, thus it knows about the inner mapping, our result would show like

In the next part I will be showing projection in Automapper.

Previous Post:
Part 1 NullSubsitution
Part 2 Flattening by Convention