简体   繁体   English

实体框架和Android中的Linq等效项

[英]Entity Framework and Linq equivalent in Android

I am new to Android. 我是Android新手。 I literally just learn Android few days ago. 我刚从几天前开始学习Android。 I am just wondering, is there Entity Framework and LINQ equivalent for Android? 我只是想知道,是否存在Android的Entity Framework和LINQ等效产品?

Also, I need to store/cache record to a local database. 另外,我需要将记录存储/缓存到本地数据库。 What the best database to use? 什么是最好的数据库? I am thinking of using SQLite. 我正在考虑使用SQLite。 Is it appropriate for Android? 它适用于Android吗?

Thanks! 谢谢!

You need an ORM(Object-Relational Mapper), there is a good cross platform ORM called Realm , Realm gives you a much more programmatic way of accessing and storing data in Objects just like LinQ or EntityFramework and executes queries pragmatically in an object oriented manner. 您需要一个ORM(Object-Relational Mapper),有一个称为Realm的跨平台ORM,Realm为您提供了更多的编程方式来访问和存储对象中的数据,就像LinQ或EntityFramework一样,并且以面向对象的方式务实地执行查询。

Sample Realm Code 领域代码示例

RealmResults<User> result = realm.where(User.class)
                                 .greaterThan("age", 10)  // implicit AND
                                 .beginGroup()
                                      .equalTo("name", "Peter")
                                      .or()
                                      .contains("name", "Jo")
                                 .endGroup()
                                 .findAll();

Documentation 文献资料

SqLite is appropriate to store local Data for example: if you are retrieving JSON, u can us an sqlite database to store some data for the offline mode, and of course u can use the cache as well, but i recommend u SQLite. SqLite适合存储本地数据,例如:如果您要检索JSON,您可以使用sqlite数据库存储脱机模式下的某些数据,当然您也可以使用缓存,但是我建议您使用SQLite。

Hope i helped. 希望我能帮上忙。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Linq相当于Android Sqlite? - Linq equivalent in Android Sqlite? 等同于带有MvvmCross框架的Android中的UserControl - Equivalent to UserControl in Android with the MvvmCross framework 在android studio中进行android开发的sqlite实体框架? - Entity framework for sqlite in android development in android studio? 什么是(如果有的话)首选Android等效于iOS的加速/ veclib vDSP框架? - What is (if there is) the preferred Android equivalent to iOS accelerate/veclib vDSP framework? 带有Android c#Cant的Entity Framework Core无法找到MigrateAsync - Entity Framework Core with Android c# Cant Find MigrateAsync 当等效的curl成功时,Truevault请求在Android上使用实体生成器失败。 对更改代码有何建议? - Truevault request failing using entity builder on android while the curl equivalent is successful. Any suggestions for changes in the code? 实体框架核心无法在Android三星设备上创建数据库文件 - Entity Framework Core can't create database file on android samsung devices 如何访问 android 设备上的数据库文件 [Xamarin App with Entity Framework for SQLite] - How to access a database file on android device [Xamarin App with Entity Framework for SQLite] 相当于Android中的plist - Equivalent of plist in Android iOS中的iOS BackgroundFetch相当于Android - iOS BackgroundFetch equivalent in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM