Using DTO in ASP.NET MVC

In the context of ASP.Net MVC 2.0, can anyone explain why we need to use a DTO (data transfer object) if there can already be models? I saw an example where a web service returns a DTO in asp.net and then converted to a model using some factory class. This web service negotiates with the database and returns the data as a DTO.

In my previous projects, I used to communicate with the database using the data context and the repository, which was used to return the model object to my controller. Then I used this model for an appropriate view. Isn't that easier? I cannot pinpoint the use of DTO pattren.

+3
source share
1 answer

, . 1:1 () . , Model == DTO, , DTO .

, MVC, . , .

+5

Source: https://habr.com/ru/post/1795934/


All Articles