What is the difference between an MVC Model object, a domain object and a DTO

前端 未结 6 1482
遇见更好的自我
遇见更好的自我 2020-12-22 15:54

What is the difference between a MVC Model object, a domain object and a DTO?

My understanding is:

MVC Model object:

Models the data

6条回答
  •  攒了一身酷
    2020-12-22 16:18

    Domain and model objects are essentially the same, and may contain business logic. Depending on implementation, domain and DTO objects may be equivalent if you remove business logic from the model into a service class.

    Often a key variant of the DTO is the View Model, which is used purely to transfer data between the domain model and the view, although often a View Model may contain logic, although this should be purely UI logic.

提交回复
热议问题