Coder Social home page Coder Social logo

chrisrowtcliff / mobile-app-documentdb-offlinesync-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karolzak/mobile-app-documentdb-offlinesync-sample

0.0 0.0 0.0 168 KB

This is a proof of concept project where we tight up a DocumentDB instance with complex (nested) types with several SQLite mobile clients using Azure Mobile Apps with Offline Sync.

License: MIT License

C# 100.00%

mobile-app-documentdb-offlinesync-sample's Introduction

Azure Mobile Apps using DocumentDb + Incremental and offline sync

This is a proof of concept project where we tight up a DocumentDB instance with complex (nested) types with several SQLite mobile clients using Azure Mobile Apps with Offline Sync. In this project we are trying to achieve following features:

  • Accessing data from DocumentDB on mobile clients through Azure Mobile Apps
  • Ability for mobile clients to work with downloaded data in offline mode
  • Incremental sync on client to download only updated/added/data (limits the data transfer)
  • Support for flat DocumentDB objects
  • Support for more complex nested objects

Key points:

  • Custom DomainManager for TableController - it allows us to sync data on client through Azure Mobile Apps Tables to work with DocumentDB objects
  • Azure Mobile Apps client SDK with offline sync configuration uses "createdAt" and "updatedAt" attributes to determine which objects needs to be synced. THESE ARE CASE SENSITIVE!! We learned it the hard way...
  • At this point of time (16.01.2017), Azure Mobile Apps client SDK offline sync feature works only for flat objects. It's not suitable for more complex and nested types
  • Best we could achieve was to implement offline sync for level 1 nested objects similar to this:
{
 "text": "Mew task ios",
 "nested": {
   "nestedText": "144 J B Hazra Road",
   "nestedBool": "false"
 },
 "nestedItems": [
   {
     "nestedText": "xxoxoxoxoxox",
     "nestedBool": "true"
   }
 ],
 "complete": true,
 "id": "8d16700a-fcc0-4453-b740-e3eef8c0c340",
 "version": null,
 "createdat": "2017-01-11T12:27:24.1394782+00:00",
 "updatedat": "2017-01-11T14:24:03.4335527+00:00",
 "deleted": false
}

Unfortunately, nested objects/collections can only be stored as strings/JSON in SQLite store on mobile client: alt text

We achieved this by implementing a custom Expand attribute to include nested objects when sending data from Azure Mobile App to client. We used it in our TableController here

mobile-app-documentdb-offlinesync-sample's People

Contributors

karolzak avatar dibranmulder avatar

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.