C
C#3w ago
workani

✅ Why some people don’t like Automapper?

I’ve learned about this tool about a month ago, since then I’ve been constantly using it without any problems. But some people thinks that it is unnecessary, and I’m curious why. Is there any significant disadvantages to this approach for mapping?
7 Replies
Anton
Anton3w ago
1. It gives you errors on mapping in runtime rather than compile-time. This makes iterations longer. You can kinda circumvent this with a test, but it's still way slower than getting a compile time error and knowing exactly where that is. 2. It's slow. 3. It allows you to introduce dependecies and business logic into the mapper, which is bad practice.
FusedQyou
FusedQyou3w ago
Because you just limit your ability to write a proper response object and half the time you end up having to manually insert hacks or configuration anyway It's also very easy to make a static/instanced method on the class to convert it back and forth
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
Angius3w ago
You can also use something like Riok.Mapperly that does the same thing, but via source generators. So code flow can be tracked and errors are on compile time, since it generates real code instead of using reflections
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX3w ago
If you have no further questions, please use /close to mark the forum thread as answered
workani
workaniOP3w ago
Thanks for answers!

Did you find this page helpful?