Should a service layer return view models for an MVC application?

后端 未结 6 1760
时光说笑
时光说笑 2020-12-04 12:52

Say you have an ASP.NET MVC project and are using a service layer, such as in this contact manager tutorial on the asp.net site: http://www.asp.net/mvc/tutorials/iteration-

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 13:31

    No, I don't think so. Services should care only about the problem domain, not the view that renders results. Return values should be expressed in terms of domain objects, not views.

提交回复
热议问题