Taswar Bhatti
Practical guides on AI agents, LLM security, C#/.NET and Cloud, from Taswar Bhatti
Tag: object mapping
automapper

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.

… Read the rest “Automapper: Mapping objects Part 2 of 7 (Flattening by Convention)”
automapper

Recently I gave a talk on Automapper in Ottawa .Net Community, so I though I would post the main ideas of the presentation here also.

The demo was based on an Order System where there were just 3 tables/classes, “Order”, “Customer” and “OrderItems”

Object diagram

From the diagram we can see that a Customer has a Bio and if we pull out all the customer from a repository and display it, we may have some of them whom are missing the Bio.

Here is the code of how we are mapping our domain objects to a Dto or ViewModel, we are basically just passing the data to the View to render

… Read the rest “Automapper: Mapping objects Part 1 of 7 (NullSubstitution)”
UA-4524639-2