eShopOnWeb has a couple of uses of AutoMapper just so developers can see how to wire it up but in general to me AutoMapper is really overused.
I’ve seen developers take onboard this dependency for the sake of saving 15 lines of code… but… it has a real cost which many developers don’t appreciate.
It’s another ‘thing’ in the architecture, its another thing that has to be documented, thought about, talked about, it’s another thing you have to give any new developer time to get used to, its another thing to debug, another thing which can break, another thing that can have security vulnerabilities, another thing to upgrade, another thing that can stop being maintained etc..
I’ve used it on a couple of projects and it’s always cost more time than it has saved. It’s probably the best at what it does but even it’s author Jimmy Bogard knows its used in ways it ways he never intended for it to be used…
IMHO left->right assignment is amongst the easiest code any developer is ever going to write so I avoid downloading AutoMapper as simply put I don’t think it’s needed.
If you are using it, from my own experience I’ve found it is the custom mappers that cost most config and debug time so I’d recommend just using the default map capabilities and then using plain left-right assignment for anything that doesn’t map out of the box.. eg..
OrderDto dto = Mapper.Map<OrderDto>(order);
dto.CustomerFullName = order.FirstName + ‘ ‘ + order.LastName;
.. this means you’re using less of the complex features of AutoMapper but still getting the majority of your properties mapped.
Do you use AutoMapper in your projects?