Should AutoMapper be used to Map from ViewModel back into Model?

南楼画角 提交于 2019-12-11 17:22:41

问题


Should AutoMapper be used to take data from ViewModel and save back into a database model?

I know the opposite practice is good software practice: to have Automapper to extract database models, and place them in Viewmodels for front end web applications.

I was reading this general article here: The article was not specifically about Automapper, but want to validate if the opinion is true. best way to project ViewModel back into Model

"I believe best way to map from ViewModel to Entity is not to use AutoMapper for this. AutoMapper is a great tool to use for mapping objects without using any other classes other than static. Otherwise, code gets messier and messier with each added service, and at some point you won't be able to track what caused your field update, collection update, etc."

Relocating here: https://softwareengineering.stackexchange.com/questions/387385/should-automapper-be-used-to-map-from-viewmodel-back-into-model

来源:https://stackoverflow.com/questions/54739423/should-automapper-be-used-to-map-from-viewmodel-back-into-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!