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

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

    A DTO = is an object that carries data between processes.
    

    But the most interesting part is that, it does not have any behavior except for storage and retrieval of its own data!!!

    Sticking with the MVC methodology...

    Domain = subject of your entire application.
    
    Model = contains the (programming languages objects : EX: C# objects) to make up the universe of your application.
    

    They can obvioussly have behaviour and properties(see difference with DTO).

    Often an application (a light one) can have one model - case in which your model is exactly your domain. Another model can be, a totaly different object type, that is processing another one. Both of them, in this case are part of your domain, and are named "domain models - objects".

    Hopefully this answer is exhaustive and makes it all clear for you !

提交回复
热议问题