What's the point of separating the Model from the View Model? (MVVM)

前端 未结 4 1596
情歌与酒
情歌与酒 2021-01-20 03:03

I don\'t think I understand the MVVM pattern properly because having a Model and ViewModel class seems redundant to me.

My understanding of the Model is to basicall

4条回答
  •  深忆病人
    2021-01-20 03:12

    One more simple example. In the current Distributed Architecture it is not necessary that your database(Model) and the business logic(VM) are designed on the same physical system. So it is possible that the data(Model) is exposed by some service (like WCF or WebApi) which can then be easily consumed by the VM (by adding the respective dll in your project).

    One more important point is that it is not necessary that you would display each and every column of the table in your database on the UI. So by having a Model the VM would only get the relevant data which is necessary for the end user on the UI.

提交回复
热议问题