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

前端 未结 6 1496
遇见更好的自我
遇见更好的自我 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:17

    Any definition for most of the objects is various based on place of using of objects:

    Model: is a general definition for using object in client or server.

    1. Model View : is a object using in client most of the time.
    2. Domain Object : is a object using in server and transfering data to the database.
    3. Data Transfer Object(DTO) : is a object that transfer data from one object to another object, specially in getting data in API Call(for example: in api GET Method call for getting data you must not to give database models to client, for this purpose you use dto).

    Notice: the definitions are true most of the time but in some situations arent't practical.

提交回复
热议问题