【发布时间】:2019-07-04 10:35:51
【问题描述】:
我正在将旧应用程序重构为 mvvm 模式,使用房间、存储库、视图模型等。
我有一个旧代码,其中包含具有许多功能的内容提供程序辅助类:
public static int deleteOldLogs(int NumDays) {
//get NumDays before today, then constract a content provider delete command and run
...
}
or
public static Cursor getTodayLogs() {
//get a day from today, then constract a content provider query and run
...
}
or
public static boolean isActionValid(Context context, int id_order, int id_actionh) {
//get all products from database table, then check if all products match some criteria, then return boolean result
...
}
我的问题是在哪一层放置这个逻辑?它是应该包含的存储库还是视图模型?我在网上看到的所有例子都很简单,不适合我的目标。
【问题讨论】:
标签: android mvvm architecture repository android-room