Windows Mobile 5.0 Data Access And Storage Webcast
1. Windows Mobile: Data Access and Storage Vinod Kumar M Technology Evangelist Microsoft India http://blogs.sqlxml.org/vinodkumar http://www.ExtremeExperts.com
25. DataSet Copy Method (continued) [WebMethod] public void SaveSnapshot(DataSet ds) { WriteDataSetToDatabase(ds); } private void Upload(DataSet ds) { DataServerProxy wsProxy = new DataServerProxy(); wsProxy.SaveSnapshot(ds); } Target Web Service Device call – Too slow, user must wait for whole upload
26. DataSet Copy Method (continued) private void Upload(DataSet ds) { DataServerProxy wsProxy = new DataServerProxy(); wsProxy.BeginSaveSnapshot(ds, null, null); } private void Upload(DataSet ds) { DataServerProxy wsProxy = new DataServerProxy(); DataSet dsDupe = ds.Copy(); wsProxy.BeginSaveSnapshot(dsDupe, null, null); } Device call – Changes to data during upload will corrupt upload Device call – Send copy in background, this is safe
27.
28.
29. DataSet Retrieving Changes from server [WebMethod] public DataSet GetLatest(DateTime startingDate) { return RetrieveChangesFromDatabase(startingDate); } private void GetUpdates(DataSet currentDs, DateTime lastUpdate) { DataServerProxy wsProxy = new DataServerProxy(); DataSet changeDs = wsProxy.GetLatest(lastUpdate); currentDs.Merge(changeDs); } Web method on server Call to web method from device
30. DataSet Sending Changes to the server [WebMethod] public void StoreUpdates(DataSet changeDs) { ApplyChangesToDataBase(changeDs); } private void SendChanges(DataSet currentDs) { DataServerProxy wsProxy = new DataServerProxy(); DataSet changeDs = currentDs.GetChanges(); wsProxy.StoreUpdates(changeDs); } Web method on server Call to web method from device