programming4us
programming4us
DATABASE

Synching an On-Premises Database with SQL Azure

2/11/2011 11:35:39 AM
The SQL Azure Data Sync Service only works between SQL Azure databases. However, Microsoft has released a Community Technology Preview (CTP) of a tool called Microsoft Sync Framework Power Pack for SQL Azure. This tool lets you synchronize your local database with an Azure database.

You can download the Power Pack by going to www.microsoft.com/downloads and searching for "Sync Framework Power Pack". The download page includes a Microsoft Word document that walks you through the Power Pack's features, functionality, and components. Download the Power Pack and also that Word file with the documentation. Be sure to read the documentation!

After the tool is downloaded, you can install it by double-clicking the .msi setup file. The install is simple and takes only a few minutes. When it's finished, a new SQL Azure Data Sync item appears on your Start menu. Click it to open the SQL Azure Data Sync wizard, shown in Figure 1.

Figure 1. SQL Azure Data Sync Wizard

NOTE

This tool requires the Microsoft Sync Framework 2.0 SDK. Even though you may be able to start the tool and walk though the wizard, synchronization will fail if you don't have the Microsoft Sync Framework 2.0 SDK installed.

The SQL Azure Data Sync Wizard walks you through several steps to connect to your SQL Azure database and a local SQL Server instance, and select the local tables you want to synchronize. Your progress through the wizard is displayed at left.

This tool is smart. First, the destination database doesn't need to exist in SQL Azureā€”the tool creates it for you. Second, if any of your local tables don't have a primary key, the sync doesn't happen.

One of the components included in the Power Pack is a Visual Studio plug-in that adds a new template called SqlAzureDataSyncClient. This template allows developers to write applications that provide offline synchronization. If you're using VS 2010, the template doesn't appear in the list of available templates until you copy the AddSqlAzureDataSyncCacheTemplate.zip file found on your C drive at

Users\[Username]\My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#\

to the following, new destination:
Users\[Username]\My Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#\


Restart Visual Studio, and the template shows up in the list of templates when you add a new item to your Visual Studio project, as shown in Figure 2.

Figure 2. SQL Azure Data Sync template

Selecting the SQLAzureDataSyncClient template starts a wizard similar to the one shown in Figure 11-18, which walks you through creating an offline data cache in SQL Compact. When the wizard is completed, a SQL Compact database is created, and code is generated that allows for offline synchronization to sync changes on demand. The code generated is a set of classes that provides the synchronization capability.

Other  
 
 
Video tutorials
- How To Install Windows 8

- How To Install Windows Server 2012

- How To Install Windows Server 2012 On VirtualBox

- How To Disable Windows 8 Metro UI

- How To Install Windows Store Apps From Windows 8 Classic Desktop

- How To Disable Windows Update in Windows 8

- How To Disable Windows 8 Metro UI

- How To Add Widgets To Windows 8 Lock Screen

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010
programming4us programming4us
programming4us
 
 
programming4us