DTO = ViewModel?

2019-01-12 18:43发布

I'm using NHibernate to persist my domain objects. To keep things simple I'm using an ASP.NET MVC project as both my presentation layer, and my service layer.

I want to return my domain objects in XML from my controller classes. After reading some posts here on Stack Overflow I gather DTOs are the way to go. However, I've also come across posts talking about the ViewModel.

My question: Are Data Transfer Objects and ViewModels the same thing? Or is a ViewModel a kind of sub pattern of a DTO?

7条回答
ゆ 、 Hurt°
2楼-- · 2019-01-12 19:12

if you will use DTO as ViewModel, that means you are making high dependany on DTO because of some reason you are changing DTO then it could impact on ViewModel.

Better use DTO & convert into viewmodel.

查看更多
登录 后发表回答