MVVM 中的模型是什么? [英] What goes in Model in MVVM?
本文介绍了MVVM 中的模型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
应该进入Model的东西也可以进入View-Model,即Public Properties、IDataErroInfo和INotifyPropertyChanged,那么什么应该进入模型?
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 should actually go into the model?
推荐答案
模型
业务数据 + 业务逻辑 + 业务规则
Model
Business Data + Business Logic + Business Rules
应用界面
使用最少的工作量/代码,可以通过视图轻松读取/绑定的 Wrapper Over 模型.
Wrapper Over Model which is easily readable/bindable by View using minimum Effort/Code.
IDataErrorInfo
- 应该进入 ViewModelINotifyPropertyChanged
- 应该进入 ViewModel.必要时也可以进入模型(但不推荐)- 公共属性 - 是的,模型当然应该拥有它们.
IDataErrorInfo
- Should go into ViewModelINotifyPropertyChanged
- Should go into ViewModel. Could also go in the Model if necessary (But not recommended)- Public Properties - Yes of course a Model should have them.
这篇关于MVVM 中的模型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文