In this part I will be showing how Automapper uses flattening by convention.
If we look at our OrderDto we will see that it has a IEnumerable of OrderItemsDto and also something called OrderNumber. This is the type of object we want to send to our presentation layer.
In Automapper there is a convention where it sees the method has a Get in front it. It will then auto flatten it by convention. See how in the OrderDto I have Total as a property and also CustomerName.
As you can see Automapper automatically has pulled out GetTotal and populated Total Property and so is Customer object with GetName method with CustomerName. By using these simple conventions it automatically does the work for you without explicitly specifying it.
In next part we will talk about Nested mapping.
Thank you so much for this nice tutorial.
I am waiting for the next.