Windows Azure Sync Service Sample Available for Download
The Windows Azure Sync Service Sample is a complete sample that shows you how to extend the reach of your data to anyone that has an Internet connection. The sample uses Microsoft Sync Framework 2.1 deployed to a Windows Azure Hosted Service, so your data extends even to users who have a poor or intermittent connection because the data needed by the user is kept on the user's local computer and synchronized with the server database only when needed.
The typical scenario for this sample is when you have data that is stored in a SQL Azure database and you want to allow remote users to have access to this data but you don't want to allow users to connect directly to your SQL Azure database. By creating a middle tier that runs as a Windows Azure Hosted Service, client applications connect to your hosted service, and the service connects to your SQL Azure database, providing a layer of security and business logic between the client and the server. Client applications can create a synchronization relationship with your server database, take their data offline, and synchronize changes back to the server database when a connection is available. In this way, client applications operate seamlessly even when the Internet connection is unreliable.
Why Deploy to Windows Azure Hosted Service?
Deploying Sync Framework in a middle tier component as a Windows Azure Hosted Service gives the following benefits:
- Security: No need to allow users direct access to your SQL Azure database. You control the middle tier, so you control exactly what flows in and out of your database.
- Business rules: The middle tier allows you to modify the data that flows between the server database and the client, enforcing any rules that are peculiar to your business.
- Ease of connection: The hosted service in this sample uses Windows Communication Foundation (WCF) to communicate between the client and the middle tier component, allowing a flexible and standard way of communicating commands and data.
The sample is a 3-tier application that includes these components:
- SyncServiceWorkerRole: a Windows Azure worker role that runs in the middle tier. This component handles the majority of synchronization operations and communicates with the web role component by using a job queue and blob storage.
- WCFSyncServiceWebRole: a Windows Azure web role that runs in the middle tier combined with a proxy provider that runs in the client application. This component uses WCF to communicate between the proxy provider on the client and the web role on Windows Azure, and communicates with the worker role component by using a job queue and blob storage.
- ClientUI: a Windows application that you use to establish a synchronization relationship between a SQL Server Compact database and the SQL Azure database. This component uses WCF to communicate with the web role component.
For a complete walkthrough of the sample, see Walkthrough of Windows Azure Sync Service Sample.