NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices

Tuesday, February 21, 2006

Web Services,Datasets and Compact Framework

Transferring datasets through the wire between a Compact Framework based application and Web Service is a common data transfer practice. However, it may turns to a big pain from a performance point of view if not done properly.

So, when dealing with datasets consider the following approaches:

  • Design your application so that only the needed data is transferred. For example transfer only changed data. In case you are targeting CF2.0 you may use DataSet.GetChanges() and DataSet.Merge() methods. However if you are still targeting CF1.0 you should deal with it manually. This post explains it in general

  • Compress the data transferred. Read the following articles:

  • And finally serialize DataSet to Xml and then send it over the wire as a string. This could improve performance in some scenarios; prototype, measure and analyze to see if this could really help in your particular case. Transfer the DataSet schema as well to imrpove DataSet load time

Wednesday, February 08, 2006

Data transfer options between mobile devices and Desktop with Compact Framework

Following brief list of data transfer options, which may be used in CF applications:

   The following classes from System.Net.Sockets namespace may be used for TCP/IP based communication: Socket,TcpClient and TcpListener. They provide a fast stream-based communication model.
This post of David Kline provide a simple object remoting by using Xml serialization and TcpClient/TcpListener

2.HTTP Request
   Namespace System.Net provide 2 classes (HttpWebRequest,HttpWebResponse) which may be use to deal with raw http requests.
See more here and here

3.Xml Web Services
   .NET CF provide good support for Xm Web Services consuming. According to MSDN it is the "primary feature" of the compact framework. Consuming Xml Web Service is easier as pointing the location of the web service.
A good start may be found here

4.Sql Ce and Remote Data Access (RDA)
   RDA is a lightweight mechanism for data synchronization between Sql Server Mobile(Sql Ce) and Sql Server running on the PC. You may store your data locally on the mobile side in Sql Ce database and synchronize the data with a remote Sql Server database when the device is connected.
See more here and here

5.Sql Ce Merge Replication
   It is just another and more powerful approach for synchronizing data between Sql Ce and Sql Server databases. Sql Ce Merge replication is based on SQL Server merge replication. It requires more configuration and maintenance at the server, but provides built-in and custom conflict resolution capabilities and tools for configuration and monitoring
See more here

RAPI stands for "Remote API". It allows desktop applications to make function calls on the mobile device.
See more here
OpenNETCF Desktop Communication namespace provide easier way to make your desktop application RAPI enabled

7.ActiveSync data synchronization
ActiveSync may be used for automatic synchronization of contacts,calendar and even files. You need to just to put the files in the right folder.
See more here

8.File copying over a network share
Files may be copied by using windows network shares.

Selecting the right way to transfer data requires good understanding of the pros and cons. A lot of factors should be considered before taking the right one. Some of these factors are maintenance, scalability, locus-control, performance, dev.cost, interoperability,security,the mobile platform characteristics,etc.