GithubHelp home page GithubHelp logo

mobile-orm's Introduction

Mobile ORM for Android

License: AGPL v3

Easy, Developer Friendly and fully customizable ORM for Android Databases works with Data Mapping between models (tables).

Easily manage relation between tables and browse records for ManyToOne, ManyToMany and OneToMany without writing query or making object of related model (table).

DOWNLOAD

Android Gradle:

Android Studio 3.0+

implementation 'com.oogbox.support:mobile-orm:1.0.0'

Older Android Studio

compile 'com.oogbox.support:mobile-orm:1.0.0'

FEATURES

  • Auto Database Creation. (No worry for create statements)
  • Different data types support; Basic and relation types (ManyToOne, ManyToMany and OneToMany)
  • Easy record browsing for relation records
  • Content Provider implimentation (Minor setup and all done). Mainly for sync-adapters and services
  • DataResolver for better query management with Content Provider
  • Quick Relation record create support (Directly create ManyToOne, OneToMany or ManyToMany records for main record creation)
  • and much more...

GETTING STARTED

Before start to use mobile-orm you required to set some basic configuration.

Registering Meta in AndroidManifest.xml

You can init MobileORMConfig with key DATABASE_CONFIG and path of your class

  <application ....>
  ....
  		<meta-data android:name="DATABASE_CONFIG"
  				   android:value="com.my.application.db.DatabaseConfig"/>
  ...
  </application>

Here, com.my.application.db.DatabaseConfig is class with your database configuration which extends MobileORMConfig class.

public class DatabaseConfig extends MobileORMConfig {

    public DatabaseConfig(Context context) {
        super(context);
    }

    @Override
    public String getDatabaseName() {
        return "MobileORMSample.db";
    }

    @Override
    public String authority() {
        return getContext().getString(R.string.db_authority);
    }
}

Reason behind making Config class and adding path to meta-data?

Yes, because in some case when you need to create database based on user properties such as, different database for different user. That can be handled from this configuration.

authority() is optional if you need to use ContentProvider mechanism.

Changing Database version:

  <application ....>
  ....
  		<meta-data android:name="DATABASE_VERSION"
  				   android:value="2"/>
  ...
  </application>

That's it. You have configured your MobileORM.

What's next ?

  1. Creating Model (Table)
  2. Register model in configuration
  3. Data types (Fields)
  4. CRUD Operations
  5. Working Relation records (ManyToOne, OneToMany, ManyToMany)
  6. Setting up for Content provider
  7. Working with DataResolver

Give Feedback

mobile-orm's People

Contributors

bunny-oogbox avatar openongo avatar

Watchers

James Cloos avatar

Forkers

kit9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.