Hi,I need to create DTO's objects to move data from domain to viewmodels.The problem is that in presentation layer i use global.asax to do the profile creation for all the mapping for the viewmodels, bu where and how I do the mapping in the service layer?
Hi,I need to create DTO's objects to move data from domain to viewmodels.The problem is that in presentation layer i use global.asax to do the profile creation for all the mapping for the viewmodels, bu where and how I do the mapping in the service layer?
Thanks.
--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/automapper-users/-/lICNXtcBwgEJ.
To post to this group, send email to automapp...@googlegroups.com.
To unsubscribe from this group, send email to automapper-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/automapper-users?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msg/automapper-users/-/8f1OVVr2hYwJ.
--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/automapper-users/-/ojeofgADI6gJ.
Anothor option is to put the mapping creation in a static constructor of the class where you call the mapping. I really liked that approach as usually the mapping is tightly coupled to where the mapping is called but it is not really testable.-- Ramon
--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/automapper-users/-/gkyOCwUBc30J.
If I may add: DTO's are not view models. DDD and system architecture does not employ convention over configuration. So, in short, why expose domain entities in the instance when a ViewModel needs to be constructed? What if the domain entity contains security details the view (or developers on the UI layer) should never have access to?Maintaining a proper architecture with boundaries across layers imposes no risk since the possibility doesn't exist. My opinion, keep Automapper in the service layer, and in the UI layer;
DTO to ViewModel mapping in UI layer <-> DTO to Entity mapping in service layer <-> Service layer <-> Data Access Layer
--
--