将业务逻辑保留在MVVM的模型中,这是最佳做法吗? [英] Is that a best practice to keep business logic in Models in MVVM?

查看:86
本文介绍了将业务逻辑保留在MVVM的模型中,这是最佳做法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个学生班级,在我的观察中,创建和填充学生的测试成绩(来自数据库/服务)应在不同的班级(可能是工厂模式)中进行处理,这是最佳实践吗?还是应该填充学生班的数据?

请指教!

-Vallarasu S.

Say I have a student class, in my observation creating and populating the test scores of a student (from a DB/Service) should be handled in a different class (possibly a factory pattern) is that a best practice? or should I populate the data from the student class?

Please advice!

-Vallarasu S.

推荐答案

MVVM(如果是WPF前景的最佳实践).通过使用此功能,您可以更有效地管理应用程序.因为它会将您的用户界面与您的代码文件分开.因此,多个用户可以在同一模块上工作.如果您在用户界面中进行了更改,那么您的代码就不会麻烦了.模块之间的耦合非常松散,因此每件事都是非常独立的.
MVVM if best practice for WPF prospect. By using this u can manage u application more efficiently. Because it separate ur UI with ur code files. So multiple user can work on same module. If u have change in ur UI the it will not much bother ur code. Coupling between module is very loose so every thing is very much independent.


这篇关于将业务逻辑保留在MVVM的模型中,这是最佳做法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆