SlideShare a Scribd company logo
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
acasquete
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
The applications require a local storage
File System

App Data Store

C# / JavaScript

SQLite

IndexedDB

Javascript
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
Windows Azure Mobile Services are ideal for:
Working with disconnected data in Windows Store apps
Optimistic Concurrency Control
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
File System

App Data Store

C# / JavaScript

SQLite

IndexedDB

Javascript
many browsers
// Opening a Database
var
// Assume db is a database variable opened earlier
var
var
// Define a person
var
// Perform the add
var
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps
// Opening a Database
var db = new PouchDB('dbname');
// Add an object
db.put({ _id: ’me@email.com', name: ’Alex', age: 66 });
// Subscripbe to changes
db.changes({
onChange: function() {
console.log('Ch-Ch-Changes');
}
});
// Replicate to external DB
db.replicate.to('http://example.com/mydb');
Working with disconnected data in Windows Store apps
http://www.windowsazure.com/en-us/develop/mobile/tutorials/handle-databasewrite-conflicts-dotnet/
http://msdn.microsoft.com/en-us/library/windowsazure/hh456371.aspx
http://www.sqlite.org/docs.html
http://pouchdb.com
Working with disconnected data in Windows Store apps
Working with disconnected data in Windows Store apps

More Related Content

PPT
Visualizing a Database Structure with SchemaSpy
PPTX
Couch db
PDF
Scaling ArangoDB on Mesosphere DCOS
ODP
Introducing CouchDB
RTF
SPHE-00727_description
PPTX
MongoDB - A next-generation database that lets you create applications never ...
PDF
FITC presents: Mobile & offline data synchronization in Angular JS
PDF
CouchDB Mobile - From Couch to 5K in 1 Hour
Visualizing a Database Structure with SchemaSpy
Couch db
Scaling ArangoDB on Mesosphere DCOS
Introducing CouchDB
SPHE-00727_description
MongoDB - A next-generation database that lets you create applications never ...
FITC presents: Mobile & offline data synchronization in Angular JS
CouchDB Mobile - From Couch to 5K in 1 Hour

What's hot (20)

PDF
Relevance trilogy may dream be with you! (dec17)
PDF
Replicating application data into materialized views
PDF
Scaling ArangoDB on Mesosphere DCOS
PDF
Electron, databases, and RxDB
PDF
Updating materialized views and caches using kafka
ODP
Polyglot persistence with Spring Data
PPTX
The Basics of MongoDB
PDF
Creating data centric microservices
PDF
your browser, my storage
PPT
Grails Controllers
PDF
MeteorJS Introduction
PDF
Client Server Communication on iOS
PPTX
Introduction à DocumentDB
PDF
FOXX - a Javascript application framework on top of ArangoDB
PDF
Олексій Калініченко — Configuration Management in Drupal8
PDF
N hidden gems in hippo forge and experience plugins (dec17)
PDF
Azure sql database limitations
PDF
N hidden gems in forge (as of may '17)
PPTX
Asp.net
PDF
In-depth changes to Drupal 8 javascript
Relevance trilogy may dream be with you! (dec17)
Replicating application data into materialized views
Scaling ArangoDB on Mesosphere DCOS
Electron, databases, and RxDB
Updating materialized views and caches using kafka
Polyglot persistence with Spring Data
The Basics of MongoDB
Creating data centric microservices
your browser, my storage
Grails Controllers
MeteorJS Introduction
Client Server Communication on iOS
Introduction à DocumentDB
FOXX - a Javascript application framework on top of ArangoDB
Олексій Калініченко — Configuration Management in Drupal8
N hidden gems in hippo forge and experience plugins (dec17)
Azure sql database limitations
N hidden gems in forge (as of may '17)
Asp.net
In-depth changes to Drupal 8 javascript
Ad

Viewers also liked (6)

PDF
Everyday - mongodb
PPT
Eficientizarea IT - Temperfield
PDF
DOCX
тезисы к докладу по электронной аутентификации в государственных системах
PDF
Nuxeo World Session: Nuxeo Distributions
ODP
Sso every where
Everyday - mongodb
Eficientizarea IT - Temperfield
тезисы к докладу по электронной аутентификации в государственных системах
Nuxeo World Session: Nuxeo Distributions
Sso every where
Ad

Similar to Working with disconnected data in Windows Store apps (20)

KEY
Couchdb: No SQL? No driver? No problem
PPT
Sqllite
PDF
Docker Java App with MariaDB – Deployment in Less than a Minute
PDF
Local data storage for mobile apps
PPTX
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
PDF
Web applications with Catalyst
PDF
Refreshing mule cache using oracle database change notification
PDF
Deploying configurable frontend web application containers
PPTX
Web Technologies - forms and actions
PPT
KEY
CouchDB : More Couch
KEY
[Coscup 2012] JavascriptMVC
PDF
phptut4
PDF
phptut4
PPTX
Deploying your web application with AWS ElasticBeanstalk
PDF
RESTful Web Applications with Apache Sling
PDF
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
PDF
Using Document Databases with TYPO3 Flow
ODP
Exploring Symfony's Code
PDF
Google App Engine Developer - Day4
Couchdb: No SQL? No driver? No problem
Sqllite
Docker Java App with MariaDB – Deployment in Less than a Minute
Local data storage for mobile apps
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
Web applications with Catalyst
Refreshing mule cache using oracle database change notification
Deploying configurable frontend web application containers
Web Technologies - forms and actions
CouchDB : More Couch
[Coscup 2012] JavascriptMVC
phptut4
phptut4
Deploying your web application with AWS ElasticBeanstalk
RESTful Web Applications with Apache Sling
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
Using Document Databases with TYPO3 Flow
Exploring Symfony's Code
Google App Engine Developer - Day4

More from Alex Casquete (6)

PDF
Redis no es solo una caché
PPTX
Functional Programming with F#: Getting Started & Basic Concepts
PDF
45 F#antastic minutes!
PDF
JavaScript no es Vietnam
PDF
Aplicaciones robustas con Programación Orientada a Aspectos
PDF
Entity Framework 4 desde cero
Redis no es solo una caché
Functional Programming with F#: Getting Started & Basic Concepts
45 F#antastic minutes!
JavaScript no es Vietnam
Aplicaciones robustas con Programación Orientada a Aspectos
Entity Framework 4 desde cero

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
KodekX | Application Modernization Development
PPTX
sap open course for s4hana steps from ECC to s4
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Cloud computing and distributed systems.
PPTX
Spectroscopy.pptx food analysis technology
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
Understanding_Digital_Forensics_Presentation.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KodekX | Application Modernization Development
sap open course for s4hana steps from ECC to s4
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Per capita expenditure prediction using model stacking based on satellite ima...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Cloud computing and distributed systems.
Spectroscopy.pptx food analysis technology
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Programs and apps: productivity, graphics, security and other tools
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Working with disconnected data in Windows Store apps

Editor's Notes

  • #2: Hello everyone. Thank you for coming at the last session of MCT Summit.In this talk I want to show you how to deal with connected and disconnected scenarios using Windows Store apps and how to synchronize data between a local and an external database.
  • #3: Againefore I start, I want to thanks Sponsors:Aplixure, Microsoft Learning, Virsoft. Withoutthem, this Summit wouldn’t be posible!
  • #4: As I said, I thistalk I wanttotalkdisconnectedscenarios. And I wantto show youhowto store local data usingSQLite and IndexedDB. And thenhowtosynchronizewithexternal server. We’llseehowtosyncrhonizeSQLitewith Mobile Services, and theIndexedDBwithanexternalCouchDBdatabase.
  • #5: I’m Alex Casquete I’m working in Spain as a developer and trainer in a consultant company specialized in Microsoft Technologies. The last two years I have been involved in developing mobility solutions using windows store apps and Windows azure, in particular I’m developing business store apps. Apps related with an specific business of a company. I think is in this kind of application where dealing with connected and disconnected and with how to synchronize data became important. Here you have my email address and my twitter if you want to ask me after this talk or stay in contact.
  • #6: Thisisthecommonmessagethatweseewhenanaplicattionisnotsupporting offline navigation. That means that we cant use the application if we are not connected.In manybusiness store apps, thisisnotanoption, weneedtheapplicationsalwaysrunning.
  • #7: Ok, let’sgowiththefirsttopic. The key thing is that Mobiles phone and tablets are not always connected and so experience latencies with getting data that we don’t have in on promise clients. But the application always needs to be running.
  • #8: Besides, when working in disconnected apps we need to consider other additional aspects. First, mobile devices and phones have less storage and processing capacity than a desktop or notebook computer. We need to use the local storage properly. We cant store locally a complete database.we need to use Wi-Fi connections when possible To keep down the cost of running a mobile application, and we should use a compact data format like JSON.Another consideration when working offline is that we are not working alone. Probably another disconnected user is working with the same data at the same time, and in some cases we need to resolve conflicts.All this is important, but the most important is that we need to have a local storage for the applications.
  • #9: And the options we have many options to store data locally.We can store data using the file system, we can create files in any folder to store settings or whatever.Another option is to store the data using the app local storage, and isolated storage for the app. And another solution is to use third parties databases as SQLite.But besides, if we are using JavaScript to developing Store Apps or even HTML apps, we can use IndexedDB that allow us to store a pair key/value in a local database.These last options are the recommended when we need to manipulate a large quantity of data, because if we use other mechanism, we must implement our own mechanism for searching, sorting, etc.
  • #10: SQLite is an embedded SQL database engine that does not have a separate server process. It’s working as library. The data isstored in a single file.Implementsmost of the SQL standard and we can use it in manyplatforms (…)
  • #12: Now, we have an application that stores the data locally. And now we need to upload this data to an external server so that it could we shared between all the clients. We have many options, but I want to show you how to synchronize this data using Windows Azure Mobile Services. Do you know what Windows Azure Mobile Services is?Windows Azure Mobile Servicesenablesyoutoaccelerateyourmobileappdevelopmentbyproviding a fast and easywayto store data, authenticateusers, and sendpushnotifications. Today, we’vereleasedseveralimportantupdatesto Mobile Services, includingOptimisticconcurrency in structured data todetect and resolvescenarioswheretwoor more users are concurrentlyupdatingthesame data rowWindows Azure Mobile Services is a Windows Azure service designed to make it easy to create highly-functional mobile apps. Mobile Services brings together a set of Windows Azure services that enable backend capabilities for mobile apps. Mobile Services provides a set of REST APIs that are used to access and change table data and retrieve authenticated login information.
  • #13: Windows Azure Mobile Services is a Windows Azure service designed to make it easy to create highly-functional mobile apps. Mobile Services brings together a set of Windows Azure services that enable backend capabilities for mobile apps. Mobile Services provides a set of REST APIs that are used to access and change table data and retrieve authenticated login information.Windows Mobile Service are perfect for create the backed of a Windows Store app, Windows Phone, iOS, Android, web applications.We can implementquicklycommontasks as userauthenticatio, sendpushnotifications, etc.
  • #15: Whathappensifwehavetwoclients?In some scenarios Two or more clients may write changes to the same item, at the same time. Without any conflict detection, the last write would overwrite any previous updates.Optimistic Concurrency Control assumes that each transaction can commit without any lock.Windows Azure Mobile Services supports optimistic concurrency control by tracking changes to each item using the __version system property column that is added to each table. This is a new feature added past week.Before committing a transaction, optimistic concurrency control verifies that no other transaction has modified the data. If the data has been modified, the committing transaction is rolled back.
  • #16: I’ll show you how to the application to detect these write conflicts through the __version system property. The application will be notified by a MobileServicePreconditionFailedException during an update attempt if the record has changed since the last query. It will then be able to make a choice of whether to commit its change to the database or leave the last change to the database intact. Forthis demo Imgoingto use the default solution.
  • #17: Untilnowwehaveseenhowto store local data usingSQLite and howtosinchronizewithexternal server using C# in Windows Store apps.Ifyou are using JavaScript you can do thesame. You can use SQLitedirectlyfrom JavaScript a Windows RT component and use SQLite
  • #18: But in Windows Storeswith JavaScript wehaveanotherengineto store data locally.
  • #19: IndexDBis a databaseengingsuportedbymany browsers and Windows Store appusingJavascript.We can store pairkey / value and each record isidentifiedby a uniquekey.We can store largeamount of data, images, objects, arrays, etc.
  • #20: Here we can see how to work with indexeddb.Howwe open a database.Howwecreate a transaction. When working with data in indexeddb it’s necessary to use a transaction. Transactions take two arguments. The first is an array of tables you’ll be working with. Most of the time this will be one table. The second argument is the type of transaction. There are two types of transactions: readonly and readwrite. Adding data will be a readwrite operation. And then web can add a entityusingmethodadd.
  • #21: Instead of using indexed directly we can use other libraries. In the next demo, I will show you how to work with PouchDB. PouchDBstores data in local usingindexdb.This library is an implementation of Apache CouchDB that works in a native way in every browser using IndexedDB as storage system. It has the same model of data, the same API and the same conflicts resolution that CouchDB. But the most important is that allows to synchronize the data with a CouchDB Database. To show the use of PouchDBimgoiung to create a simple app that allow to edit the infomation from a customer list and we can synchronize with other devices.
  • #26: Againefore I start, I want to thanks Sponsors:Aplixure, Microsoft Learning, Virsoft. Withoutthem, this Summit wouldn’t be posible!