使用Azure mobile service進行資料非同步更新
Azure設定步驟
- Azure 加入Mobile APP服務
- 點選該服務的資料庫連線設定
- 選擇已租用的SQL Database 或 Storage,並建立之
- 點選Easy Table後,啟用該Service之Backend Service
- 新增資料表,並確認存取權限方式
程式代碼步驟
- 用方案方式安裝Microsoft.Azure.Mobile.Client元件 in nuget
- Droid & iOS 要各別在環境設定註冊Moible Azure Service
注意事項
- 在pull時,如果要下條件,記得queryid要唯一。系統會以此id做為建增式更新的要值 (ref)
await todoTable.PullAsync("todoItems" + userid, syncTable.Where(u => u.UserId == userid));
參考範例: https://github.com/vulcanlee/Xamarin.Forms.StepByStep/tree/master/DoggyLab_Xamarin_Forms%20-%20GCM/DoggyLab https://github.com/XpiritBV/dev-days-labs/tree/master/Demos/app-tasks/DevDaysTasks/Services https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-dotnet-how-to-use-client-library/ 加入驗證 https://github.com/jamesmontemagno/app-coffeecups