The best five Android ORM frameworks, androidorm
When developing Android applications, there are several ways to save data,
One is local storage, the other is in the background (providing API interfaces), and the other is in open cloud services (such as SyncAdapter will be a good choice ).
For the first method, that is, local data storage, such as embedded SQLLite, you can directly use SQL statements, Content Provider, or ORM (Object Relational Data ing ).
Android applications are mainly developed using the Java language, so some Java-language ORM can also be transplanted to the Android platform.
The following is an overview of the five available ORM:
1. OrmLiteOrmLite is not a specialized ORM framework for the Android platform. It is a Java ORM. Supports JDBC connections, Spring and Android platforms. Annotations are widely used in syntax ).
2. SugarORMSugarORM is a specialized ORM for Android platforms. APIs is easy to learn. It can easily process 1-to-1 and 1-to-many relational data, and use the three functions save (), delete () and find () (or findById ()) to simplify basic CRUD operations.
To enable SugarORM, you need to add the following meta-data tag in the AndroidManifest. xml configuration of your application:
<meta-data android:name="DATABASE" android:value="my_database.db" /><meta-data android:name="VERSION" android:value="1" /><meta-data android:name="QUERY_LOG" android:value="true" /><meta-data android:name="DOMAIN_PACKAGE_NAME" android:value="com.my-domain" />
Then we can extend the data classes to be saved from SugarORM:
public class User extends SugarRecord<User> { String username; String password; int age; @Ignore String bio; //this will be ignored by SugarORM public User() { } public User(String username, String password,int age){ this.username = username; this.password = password; this.age = age; }}
To add a User, the Code is as follows:
User johndoe = new User(getContext(),"john.doe","secret",19);johndoe.save(); //stores the new user into the database
3. greenDAO is a fast solution when performance is very important (Data Access is frequent). It supports CRUD per second for thousands of records, compared with OrmLite, greenDAO is almost 4.5 times faster. (Benchmark for accurate data ).
GreenDAO is smaller than kb, so it has little impact on the Application APK size.
Here is a tutorial to demonstrate how to use Android Studio and GreenDAO framework in Android applications.
4. Active AndroidActive Record (Active Directory) is a typical naming method for ORM implementation in Yii, Rails, and other frameworks. Active Android helps you operate SQLite in an object-oriented manner.
If your project contains Active Android, you need to add a jar file under the/libs directory of the project. You can obtain the source code from Github and edit it using Maven. Then you should add the meta-data to the AndroidManifest. xml configuration of your application:
<meta-data android:name="AA_DB_NAME" android:value="my_database.db" /><meta-data android:name="AA_DB_VERSION" android:value="1" />
Then, call ActiveAndroid. initialize () in your Activity:
public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActiveAndroid.initialize(this); //rest of the app }}
Now, you can use Java annotations to create model classes:
@Table(name = "User")public class User extends Model { @Column(name = "username") public String username; @Column(name = "password") public String password; public User() { super(); } public User(String username,String password) { super(); this.username = username; this.password = password; }}
5. RealmRealm is an Android ORM that can be used. It is written based on C ++ and runs directly on your device hardware (which does not need to be explained), so it runs very fast. It is also open-source and cross-platform. iOS code can be found on GitHub. You can also find Objective C and Realm use instances written in Swift.
Source: http://techbrood.com /? Q = orm & s = 1 # b0fe2c8d713c24ce
By iefreer
What is the best framework for developing android apps in html5? The framework must be used. Why?
Html5 is mainly used for front-end processing, and is also used on mobile phones.
Is the application framework related to your application complexity?
If you do this at the beginning, we recommend that you do not use the framework. Otherwise, it will be limited by the framework.
If you have some development experience and try to use the framework, using the framework will be helpful for multiple projects and large projects.
For the net project framework selection (orm or other), which of the following is better for medium-sized e-commerce websites (which is suitable for performance, efficiency, and easy to maintain)
All three of them are database ORM frameworks. If you are not familiar with them and the project time is not long enough, you should stop using them,
Using EnterpriseLibrary to call SQL or stored procedures is simple and the performance can be said to be the best
The three-tier architecture called javasiselibrary source code is searched on the Internet. There are many