What is Data Transfer Object?

前端 未结 8 1200
庸人自扰
庸人自扰 2020-11-22 10:35

What is a Data Transfer Object?

In MVC are the model classes DTO, and if not what are the differences and do we need both?

8条回答
  •  佛祖请我去吃肉
    2020-11-22 10:44

    A DTO is a dumb object - it just holds properties and has getters and setters, but no other logic of any significance (other than maybe a compare() or equals() implementation).

    Typically model classes in MVC (assuming .net MVC here) are DTOs, or collections/aggregates of DTOs

提交回复
热议问题