Wednesday, October 8, 2008

Using Desktop Sync in Console - I

Before you can synchronize a Microsoft Access with a SQL Compact database, you must first "prepare" the Access database. Desktop Sync uses a hub-and-spoke data synchronization model where the Access database is the hub and the synchronized SQL Compact databases (clients) are the spokes. This means that the Access database must contain its own data tracking tables (to be able to check what changed between synchronizations) and also to track what changes on the client databases.

To prepare an Access database in Console, go to the Data Explorer pane and expand the "Desktop Sync" node. Right-click the "Microsoft Access" folder and select the "Add Database..." context menu option to display the Microsoft Access properties dialog.

This dialog allows you to enter the database file name as well as other optional properties such as the file password. After clicking the "OK" button, a new dialog is displayed to allow you to select what tables and columns are synchronized or simply exported to the client database. This selection is made by right-clicking on each node (table or column) and setting the properties for each:
  • Synchronize - The table or column will be exported to the client and changes to it will be tracked.
  • Export only - The table or column will be exported to the client and no changes will be tracked.
  • Unselect - The table or column will not be exported to the client.
Note that this version of the code assumes that when you select a table or column to synchronize, both the master and the client databases will track changes to it. There is no way to force this feature on only one of the ends of the synchronization.

When you are done selecting the required tables and columns, Console will prepare the Access database and will add it to the Data Explorer tree under the "Microsoft Access" folder. This preparation phase adds tables and columns to the tracked tables in order to allow for later tracking of changes. It is very possible that the database file grows very large - if this happens open the Microsoft Access application and compact the database file.

Under the new database tree node, you will find two folders:
  • Clients - Contains the list of synchronization clients. After preparing a database, this node should be empty. To add a new synchronization client, please use the database node's context menu.
  • Tables - Contains all the tables and columns as you selected when preparing. These are displayed for your reference only.

0 comments: