What goes in Model in MVVM?

前端 未结 2 1037
失恋的感觉
失恋的感觉 2020-12-13 15:33

The things which are supposed to go into the Model are also allowed to go into the View-Model i.e. Public Properties, IDataErroInfo and INotifyPropertyChanged, then what sho

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 16:36

    Model

    Business Data + Business Logic + Business Rules

    View

    Application UI

    ViewModel

    Wrapper Over Model which is easily readable/bindable by View using minimum Effort/Code.

    1. IDataErrorInfo - Should go into ViewModel
    2. INotifyPropertyChanged - Should go into ViewModel. Could also go in the Model if necessary (But not recommended)
    3. Public Properties - Yes of course a Model should have them.

提交回复
热议问题