MVVM中的Model有什么用? [英] What goes in Model in MVVM?
本文介绍了MVVM中的Model有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
原本应该放入模型的东西也可以进入视图模型,即公共属性,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?
推荐答案
模型
Business Data + Business Logic + Business Rules
查看
Application UI
ViewModel
Wrapper Over Model which is ealily readable/bindable by View
using minimum Effort/Code.
1) IDataErrorInfo
-应该进入ViewModel
2) INotifyPropertyChanged
-应该进入ViewModel
和Model
(如果需要,不建议用于型号)
3) Public Properties
-是的,当然Model
应该有它们.
1) IDataErrorInfo
- Should go into ViewModel
2) INotifyPropertyChanged
- Should go into ViewModel
, and Model
(if needed, not recommended for Model)
3) Public Properties
- Yes of course a Model
should have them.
这篇关于MVVM中的Model有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文