Reputation: 2601
Going through the tutorial here: http://www.asp.net/mvc/tutorials/iteration-4-make-the-application-loosely-coupled-cs
I've noticed that they are passing the EF generated entity from the controller to the service layer. Should they be passing the viewmodel instead and then do the mapping in the service layer or is what they are doing correct?
I'm trying to understand the translation of the view model into the actual domain model passed from the service layer to the persistence layer.
Thanks
Upvotes: 0
Views: 711
Reputation: 101150
The general rule is that lower layers should have no knowledge about the upper levels.
This means that the service layer should have no knowledge of the view models (since they are an implementation detail in the user interface layer)
Upvotes: 1