I'm getting a complex object from the server - lets call it ServerDTO. I want to map it to a client side object - lets call it ClientDTO.
assuming both ServerDTO & ClientDTO have the same structure inside them.
I want to map the ServerDTO object to the ClientDTO object. very simple mapping like so:
ServerDTO sd = server.Result;
ClientDTO cd = new ClientDTO();
cd.Property1 = sd.Property1;
cd.JahRas = sd. JahRas;
and so on...
so far so good.
now my question is can this mapping be done in some abstracted layer that can handle all the mapping of all my objects no matter what type or what's inside them?
so when I want to map I'll go:
ClientDTO cd = Mapper.Map(sourceServerDTO, typeOf(ClientDTO));
You might want to look at Automapper
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With