presenta www.wpc2015.it – [email protected] - +39 02 365738.11 - #wpc15it 1 WI005 - Offline data sync con SQLite in Universal Windows Platform Erica Barone Microsoft Technical Evangelist @_ericabarone [email protected]Massimo Bonanni Microsoft MVP , Intel Black Belt Intel Software Innovator @massimobonanni [email protected]
21
Embed
Offline data sync presenta con SQLite in Universal …...Agenda •SQLite UWP What is/isn’tSQLite SQLite for UWP .NET APIs SQLite.NET-PCL vs SQLitePCL Tools •Offline Data sync
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
using (var dbconn = new SQLiteConnection(DatabaseName)){
using (var statement = dbconn.Prepare(@"INSERT INTO [Libri] ([Titolo],[Abstract],[ISBN],[Pagine],[Copertina],[IdAutore])VALUES (@Titolo,@Abstract,@ISBN,@Pagine,@Copertina,@IdAutore)"))
DB.BeginTransaction();// do something with Databaseif (/* something wrong */) DB.Rollback();else DB.Commit();
using (var dbconn = new SQLiteConnection(DatabaseName)){
using (var statement = dbconn.Prepare("BEGIN TRANSACTION")){
statement.Step();}// Execute one or more statements...using (var lbrCommand = dbconn.Prepare("INSERT INTO Libri (Titolo, Abstract, ISBN) VALUES (@Titolo, @Abstract, @ISBN)")){
//.....}// COMMIT to accept all changes or ROLLBACK TRANSACTION to discard pending changesusing (var statement = dbconn.Prepare("COMMIT TRANSACTION")){
Every time the data change, the method SyncAsync must be called in order to update the SQL Database
Push sends all CUD changes since thelast push. Note that it is not possibleto send only an individual table'schanges. Push executes a series ofREST calls to your Azure Mobile Appbackend, which in turn will modifyyour server database.
Pull is performed on a per-table basis andcan be customized with a query to retrieveonly a subset of the server data. The AzureMobile client SDKs then insert the resultingdata into the local store.
UWP App
Android App
PCL
Mobile App
SQL DB
User Authentication
Twitter provider
Authentication
Offline sync
Wrap your code into a PCL
UWP App running on PC - Android App running on Android Tablet