Welcome to MSDN Blogs Sign in | Join | Help

Synchronizing Files to Windows Azure Storage Using Microsoft Sync Framework

I wanted to kick off this post by introducing myself.  I’m Michael Clark.  I lead the Sync Framework team.  I don’t normally post to this blog (Liam Cavanagh does a fantastic job of that) but wanted a forum to get the information below out for now and decided that blog would be a good venue.  One of the things that we’d like to know is if the community would like to see more posts of this nature.  If so let us know by giving us some feedback and we’ll figure out some appropriate venue to get this kind of info out on a more regular basis.

At PDC09 we talked quite a bit about how to synchronize data to the cloud.  Most of this revolved around synchronizing structured data to and from SQL Azure.  If you are interested in that, check out our Developer Quick Start, which includes a link to download Microsoft Sync Framework Power Pack for SQL Azure November CTP. 

For this post, however, I want to augment that information to answer another question that we are frequently asked and were asked a number of times at PDC, “How can I synchronize things like files with Azure Blob Storage?”  The answer at this point is that you’ll have to build a provider.  The good news is that it’s not too hard.  I built one that I’ll describe as part of this post. The full sample code is available here.

So how does it work?  The sample itself consists of three major portions: the actual provider, some wrapper code on Azure Blob Storage, and a simple console application to run it.  I’ll talk in a bit more depth about both the provider and the Azure Blob Storage integration.  On the client side the sample uses Sync Framework’s file synchronization provider.  The file synchronization provider solves a lot of the hard problems for synchronizing files, including moves, renames, etc., so it is a great way to get this up and going quickly.

The azure provider is implemented as a FullEnumerationSimpleSyncProvider, using the simple provider components of Sync Framework.  Simple providers are a way to create Sync Framework providers for data stores that do not have built-in synchronization support.

The provider itself derives from the FullEnumerationSimpleSyncProvider class, which is used for stores that don’t support any form of change detection whatsoever.  It’s extremely useful because this is actually the category that most off-the-shelf stores fall into (another great example of this type of store is the FAT file system).  Sync Framework also contains the notion of an AnchorEnumerationSimpleSyncProvider for stores that have the ability to enumerate changes based on some type of anchor (timestamp, tick count, opaque blob of goo, whatever).  But for now I’m going to focus on full enumeration as that is what is required for Azure Blob Storage at this point.

The basic idea behind a full enumeration synchronization provider is that you need to tell Sync Framework some basic information about the items you'll be synchronizing, how to identify them and how to detect a version change, and then give Sync Framework the ability to enumerate through the items looking for changes.  To tell Sync Framework about the items, override the MetadataSchema property of the FullEnumerationSimpleSyncProvider class.  When you build the metadata schema you’ll specify a set of custom fields to track, and an IdentityRule.  Together these things make up the set of data required to track and identify changes for objects in the store.  For the Azure Blob synchronization provider this property looks like this: 

public override ItemMetadataSchema MetadataSchema

{

    get

    {

        CustomFieldDefinition[] customFields = new CustomFieldDefinition[2];

        customFields[0] = new CustomFieldDefinition(ItemFields.CUSTOM_FIELD_NAME, typeof(string), AzureBlobStore.MaxFileNameLength);

        customFields[1] = new CustomFieldDefinition(ItemFields.CUSTOM_FIELD_TIMESTAMP, typeof(ulong));

 

        IdentityRule[] identityRule = new IdentityRule[1];

        identityRule[0] = new IdentityRule(new uint[] { ItemFields.CUSTOM_FIELD_NAME });

 

        return new ItemMetadataSchema(customFields, identityRule);

    }

}

 

Next, in order to let Sync Framework detect changes you need to override the EnumerateItems method.  In your EnumerateItems implementation you’ll create a List of ItemFieldDictionary objects to tell Sync Framework about all of the metadata properties you have specified in your MetadataSchema.  Sync Framework uses this information to track the state of objects in the store, looking for adds, updates, and deletes and then produces the proper synchronization metadata for those changes so that they can be synchronized with any Sync Framework provider.  The implementation for EnumerateItems in this sample looks like this:

// Enumerate all items in the store

public override void EnumerateItems(FullEnumerationContext context)

{

    List<ItemFieldDictionary> items = DataStore.ListBlobs();

    context.ReportItems(items);

}

 

There is obviously some hidden detail here because I’ve put some of the work in the store wrapper that I mentioned previously.  I’ll talk more about the store wrapper in a moment but I’ll include its ListBlobs method here since it is relevant.

internal List<ItemFieldDictionary> ListBlobs()

{

    List<ItemFieldDictionary> items = new List<ItemFieldDictionary>();

 

    BlobRequestOptions opts = new BlobRequestOptions();

    opts.UseFlatBlobListing = true;

    opts.BlobListingDetails = BlobListingDetails.Metadata;

 

    foreach (IListBlobItem o in Container.ListBlobs(opts))

    {

        CloudBlob blob = Container.GetBlobReference(o.Uri.ToString());

        ItemFieldDictionary dict = new ItemFieldDictionary();

        dict.Add(new ItemField(ItemFields.CUSTOM_FIELD_NAME, typeof(string), o.Uri.ToString()));

        dict.Add(new ItemField(ItemFields.CUSTOM_FIELD_TIMESTAMP, typeof(ulong), (ulong)blob.Properties.LastModifiedUtc.ToBinary()));

        items.Add(dict);

    }

 

    return items;

}

 

What this ListBlobs implementation does is simply walk through all of the blobs in the container (container is an Azure Blob Storage concept; in this sample I treat it like a root directory).  Then, for each blob get out the information that was specified for the MetadataSchema and build a list of that information to give back to Sync Framework.

The last crucial bit for the providers is to give Sync Framework a way to add, update, or delete items from the store.  To do this, override InsertItem, UpdateItem, and DeleteItem respectively.  I won’t include the source for those methods here for brevity but you can check them out in the sample.

There are a couple of other things that are needed for the synchronization provider but those are mostly bookkeeping and I’ll let you look at the sample to get the details.

At this point, I want to talk briefly about the store wrapper class.  The store wrapper class utilizes objects in the Microsoft.WindowsAzure.StorageClient namespace.  To get that you’ll need to download Windows Azure Tools for Microsoft Visual Studio.  I’m not going to go into too much detail about the store wrapper itself.  It has most of the methods you’d expect, such as the ListBlobs method seen above, and the corresponding methods for adds, updates, and deletes.  I do want to talk a little bit about one important detail with the store and that is optimistic concurrency.  Optimistic concurrency is the thing that will allow multiple synchronization clients to work with the store at the same time without overwriting each other unwittingly and corrupting data.  The Sync Framework simple providers are designed to work well with stores that support optimistic concurrency so that they can provide correct synchronization.

The great news is that Windows Azure Blob Storage supports optimistic concurrency well.  If you are using the StorageClient API, it does this by using a BlobRequestOptions object.  You can see an example of how this works in the DeleteFile method of the store wrapper:

internal void DeleteFile(

    string name,

    DateTime expectedLastModified

    )

{

    CloudBlob blob = Container.GetBlobReference(name);

    try

    {

        blob.FetchAttributes();

    }

    catch (StorageClientException e)

    {

        // Someone may have deleted the blob in the meantime

        if (e.ErrorCode == StorageErrorCode.BlobNotFound)

        {

            throw new ApplicationException("Concurrency Violation", e);

        }

        throw;

    }

    BlobProperties blobProperties = blob.Properties;

 

    ...

 

    BlobRequestOptions opts = new BlobRequestOptions();

    opts.AccessCondition = AccessCondition.IfNotModifiedSince(expectedLastModified);

    try

    {

        blob.Delete(opts);

    }

    catch( StorageClientException e )

    {

        // Someone must have modified the file in the meantime

        if (e.ErrorCode == StorageErrorCode.BlobNotFound || e.ErrorCode == StorageErrorCode.ConditionFailed)

        {

            throw new ApplicationException("Concurrency Violation", e);

        }

        throw;

    }

}

 

Note that by specifying the AccessCondition property of the BlobRequestOptions object, the code tells Azure Blob Storage not to touch the file if the file has been modified since the last time we looked at it.  If the file has been touched, the CloudBlog object from the StorageClient library throws StorageClientException.  For a couple of specific errors, the store wrapper converts that into ApplicationException to let other parts of the code know that they should treat this as a temporary error and temporarily skip it from the perspective of synchronization.  That code is in the DeteleItem method of the provider and looks like this:

try

{

    DataStore.DeleteFile(name, expectedLastUpdate);

}

catch (ApplicationException e)

{

    recoverableErrorReportingContext.RecordRecoverableErrorForChange(new RecoverableErrorData(e));

}

 

What this does is cause Sync Framework to temporarily exclude that particular item from synchronization. The item will be picked up again later.

Now, to run this sample you’ll need to download the Microsoft Sync Framework v2 SDK as well as the Windows Azure Tools for Microsoft Visual Studio.  The sample synchronizes to a Windows Azure Blob Storage project so you’ll need to make sure that you have an account and project set up.  To get started on that, go to http://www.microsoft.com/windowsazure/.  Finally, when running the sample you’ll need to modify the app.config file for the sample and specify the AccountName and AccountSharedKey properties for the storage project that you created.  When you actually run it from the command line, the application expects to be given a container name (this is an Azure Blob Storage concept mentioned previously) and a local path.  It will synchronize everything from the local path, including subdirectories, up to the container specified.

So that’s basically it.  Please give this a try.  If you do this with photos you can easily view them in your web browser by going to https://<accountName>.blobs.core.windows.net/<containerName>/<fileName>.jpg.  Check out the code, and let us know what you think by sending mail to syncfdbk@microsoft.com

One final note that is worth covering: A great question to ask here is, “Why not just use Live Mesh to synchronize the files?”  The answer to that is that if Live Mesh fits your scenario and requirements, then you absolutely should use it.  Live Mesh, part of the Windows Live Platform, is a great product and will allow you to synchronize files between any set of PCs and mobile devices.  It is perfect for a lot of synchronization scenarios involving files.  Most of the customers that have asked us about how to accomplish this with Sync Framework need something special.  For instance, they are creating an end-to-end application and want explicit control over everything (instead of leaving that up to the end user) including where the files are synchronized, etc.  Other examples are customers who specifically want the files in Azure Blob Storage so that they can use them with their Azure Web Application.  The bottom line is that if Live Mesh meets your needs, then great.  If not, Sync Framework is a perfect alternative for meeting the synchronization needs of your application.

So there it is.  This is a simple example of how to synchronize files with Azure Blob Storage.  You can take this a lot further by for instance hosting in a Windows Azure Web Role and storing the item metadata directly in the file metadata.  But using the method described above is fast to get up and running and performs well for a number of scenarios.  Let us know if you have any questions or comments.

The full sample code is available here.

Mike

Synchronizing a Remote Replica By Using a Proxy Provider

In a typical synchronization scenario, the two data stores are on different computers or devices that are connected over a network. A controlling application runs on a third computer or on the same computer as one of the data stores. A common way to perform synchronization is for the synchronization providers to run on the computer local to the controlling application. In a typical implementation, each provider communicates directly with the remote data store to send and retrieve data in a piecemeal fashion. This approach typically means lots of local-remote round trips to retrieve items and to apply changes, and relies on the local computer to perform the bulk of the synchronization processing. There's a better way! A more efficient method is to use a proxy provider on the local computer. The proxy provider sends metadata and data to a provider that runs on the remote computer, allowing the bulk of synchronization processing to be distributed to the remote computer. When change data caching is added, only one round trip is needed to process each change batch.

I've written an article that shows you how to implement a proxy provider that uses Windows Communication Foundation (WCF) to send data and commands over the Internet to a remote provider running on a Web server. The pattern used in this article can be easily adapted to work with any protocol over any network.

The article can be read here: Synchronizing a Remote Replica By Using a Proxy Provider.

The article draws heavily on the Sync101 with Remote Change Application over WCF sample on the MSDN Code Gallery. If you'd rather skip the reading and just look at the code, click here: Sync101 with Remote Change Application over WCF.

PDC Keynote Recording - Kelley Blue Book's use of SQL Azure Data Sync

Last week at PDC we announced the availability of our first CTP of SQL Azure Data Sync.  In the keynote, Andy Lapin of Kelley Blue Book explained how they keep their community databases up-to-date using this technolgy to synchronize data between their on-premises SQL Server and SQL Azure.  The recording is now available  for you to view (the Kelley Blue Book portion of the keynote starts at about 1:18:00). 

Ultimately, one of the goals of this CTP is to get your feedback.  What is it that you like or dislike about it?  Are you primarily interested in the Visual Studio integration or would you like us to see us add additional capabilities such as advanced monitoring or logging to the SQL Server provisioning tool.  So please send us your thoughts (good or bad) here: 

http://social.microsoft.com/Forums/en-US/syncfeedback/threads

Liam

 

New Code Sample: File Synchronization with a Simple Custom Provider

Do you have data in a custom format that you want to synchronize with a directory in the file system? This new code sample shows you how to use Sync Framework to do just that.

 

This sample shows you how to:

  • Write a simple custom provider that represents your data store.
  • Implement a data transfer interface that can send and receive data between your data store and the file synchronization provider.
  • Configure the file synchronization provider to represent a directory on your computer.
  • Synchronize between your custom data store and the directory you identify.

 

Download the sample from MSDN Code Gallery and try it out: File Sync with Simple Custom Provider Sample.

Posted by LarenC | 0 Comments

Announcing SQL Azure Data Sync (November CTP) Available for Download

Today in the opening keynote at PDC we announced the availability of SQL Azure Data Sync – November CTP, an early preview open to the public through a demonstration with Kelley Blue Book.  For those of you who have been following our blog, you may be asking yourself, what exactly does this include and how does it compare to Project “Huron” that we have been talking about for some time now?  In this post I want to give some additional details.

 

You can think of SQL Azure Data Sync as the first part of our overall Project “Huron” vision which is to create a Data Hub in the Cloud, or more specifically a place for you to easily consolidate and share all of your information.  With SQL Azure Data Sync we have worked to simplify the task of sharing information whether that is from on-premises SQL Server to the cloud or from the cloud, down to mobile users, retails stores or remote offices.   All of this being powered by the Microsoft Sync Framework.

 

SQL Azure Data Sync allows developers and DBA's to:

  • Link existing on-premises data stores to SQL Azure.
  • Create new applications in Windows Azure without abandoning existing on-premises applications.
  • Extend on-premises data to remote offices, retail stores and mobile workers via the cloud.
  • Take Windows Azure and SQL Azure based web application offline to provide an “Outlook like” cached-mode experience.

All of this is accomplished through

  • An end-user Data Sync Tool that keeps on-premises SQL Server data in sync with SQL Azure.
  • Visual Studio templates enabling developers to take Windows Azure and SQL Azure based web application offline within SQL Compact and SQL Server databases.

By downloading Microsoft Sync Framework Power Pack for SQL Azure November CTP along with the Microsoft Sync Framework 2.0, developers can use the built-in providers for SQL, allowing them to synchronize SQL Azure with other stores such as SQL Server and SQL Server Compact.  SQL Azure Data Sync is optimized for performance over high latency networks by taking advantage of features like SQL Azure Table Valued Parameters to help reduce latency and significantly boost performance.  Moving forward Microsoft we will continue to enhance this technology and focus on providing a linkage between current on-premises data sources and Windows Azure Storage as well as utilizing this technology as a basis of a developer technology that will enable the Windows Azure platform to be the platform for creating cached mode web applications.

 

To get started with SQL Azure Data Sync, you need the following:

·        Microsoft Sync Framework 2.0

·        Microsoft Sync Framework Power Pack for SQL Azure – November CTP

·        SQL Azure Server Account (register here)

After installation, you will find 2 new components to help you get started:

1)      SQL Server Provisioning Wizard:  This wizard (launched from Start | Programs | Microsoft Sync Framework | SQL Azure Data Sync Tool for SQL Server) walks you through the process of connecting SQL Server to SQL Azure through data synchronization.  Within this wizard you select the tables to provision in SQL Azure, it will create a new database and setup background synchronization to keep the two data stores in-sync.

SQL Azure Data Sync - Select Tables

 

2)      Visual Studio 2008 Template:  For users that would like to take an existing SQL Azure database offline, this new template simplifies the task of creating an offline data cache within SQL Compact.  Using the template wizard (available by right clicking on a Visual Studio Solution Explorer Application and choosing Add | New Item | SQLAzureDataSyncClient, developers can choose the SQL Azure tables that they would like to be made available offline.  After completing the wizard, a SQL Compact database will be created and code will be generated that allows the offline to synchronize changes on-demand between SQL Azure and SQL Compact.

Visual Studio Data Sync Template 

- Liam

SyncToy 2.1 Available for Download

SyncToy 2.1 has just been released to the Microsoft Download center. SyncToy 2.1 is a free application that synchronizes files and folders between locations. Typical uses include sharing files, such as photos, with other computers and creating backup copies of files and folders.

SyncToy2.1 is powered by the latest synchronization engine from Microsoft Sync Framework 2.0 and provides better performance and robustness. The new features and improvements included in SyncToy 2.1 release are:

  • Better Performance: The speed of file copy operations is significantly increased across the board.
  • Improved Robustness: Much more resilient to transient network and file system errors, and better error reporting that pinpoints which file the sync failed on in case there’s a fatal error that stops the sync.
  • Folder pair configuration backup: Folder pair configuration is automatically backed up under %localappdata%\microsoft\synctoy\2.0. You can replace SyncTopDirPairs.bin with the backup copy to resolve the last saved configuration.  
  • Bug Fixes:

o        Fixed the data corruption issue when using SyncToy with NAS drives.

o        Fixed the bug that prevented uploading files to SharePoint when using SyncToy 2.0.

o        Fixed the bug that prevented delete changes from being synchronized when the sync option was set to “Echo”.

SyncToy 2.1 is now available for download from: http://www.microsoft.com/downloads/details.aspx?familyid=C26EFA36-98E0-4EE9-A7C5-98D0592D8C52&displaylang=en.
Posted by LarenC | 3 Comments
Filed under: ,

SQL Pass Conference & Synchronization to SQL Azure

Yesterday was the first day of the SQL Server conference, SQL Pass, here in Seattle.  It was a really exciting day for me because I had the opportunity to present our new synchronization capabilities to the cloud in the opening day keynote and in a subsequent session. 

We introduced the first piece of Project “Huron”, that is a technology based on the Sync Framework enabling people to use Windows Azure as a central Data Hub for all information.  To accomplish this, later this month we will make available for download an early preview of a tool that provides the ability to extend a SQL Server on-premises databases to the cloud.  Once configured users can then easily extend data from the cloud to mobile users and remote offices. 

Using this tool and with the help of one of our partners, Archetype, we showed how companies can easily extend their on-premises SQL Servers to SQL Azure using data synchronization, allowing the data stores to co-exist and interoperate seamlessly. 

All of this can be setup using a wizard.  Then from an automatically generated SQL Agent, the synchronization process is executed periodically to move the incremental changes between SQL Server and SQL Azure. 

Here are a few screenshots of the tool:

SQL Azure Server Credentials

 Choose Tables to Sync

 

Sync Progress

 

Sync Complete

 Watch for more details over this month at the Professional Developer Conference and in this blog for other new capabilities we are providing to for integration to Windows Azure and SQL Azure.

 Liam Cavanagh

New whitepaper: Minimum Database Permissions Requirements for Microsoft Sync Framework

Are you trying to set up a sync-ready database with the lowest (i.e. most secure) permissions possible? Have you set it up, but are worried you might have opened things up too wide?

Perhaps our just-published whitepaper on this very topic can be of assistance: http://msdn.microsoft.com/en-us/library/ee730363.aspx

Posted by jomul | 0 Comments

New Sync Framework Samples

We have lots of new samples on Sync Framework Code Gallery. These samples demonstrate some of the most important and exciting features of Sync Framework 2.0. If you are new to Sync Framework or are looking for ways to write code to solve your synchronization problems, chances are we have a sample that can get you started. Here are some of the highlights:

Sync101 Samples

This set of samples illustrates various concepts and features needed to synchronize a custom data store, such as:

  • Sync101 with Simple Providers, which shows how to write a basic synchronization application that uses simple custom providers.
  • Sync101 with Constraint Conflicts, which shows how to write a standard custom provider that uses Windows Communication Foundation (WCF) to synchronize data between replicas on different computers.
  • Sync101 with Custom Filtering, which shows how to track custom filters and how to use a standard custom provider to send changes from a filter-tracking replica to two different filtered replicas.

Database Synchronization Provider Samples

This set of samples illustrates various concepts around using database synchronization providers to synchronize between SQL Server databases and SQL Server Compact databases, such as:

File Synchronization Provider Sample

This sample shows how to use the file synchronization provider.

  • File Synchronization Provider Sample, which shows how to use the file synchronization provider, a fully functioning provider that helps an application to synchronize files and folders in NTFS, FAT, and SMB file systems.

Windows 7 is out -- and with it comes Windows Sync, powered by Microsoft Sync Framework!

It's finally here!

Today is the long-awaited launch date of Windows 7, and on the Sync team we couldn't be more excited, as it is the first Windows client OS to ship with Microsoft Sync Framework running out-of-the-box. This special version of Sync Framework is powering a new feature called Windows Sync, which allows Windows users to manage their sync relationships through a user interface.

Under the hood, Sync Framework is running, and each sync relationship is being governed by custom providers that were developed to handle things like keeping contacts, calendars, notes and tasks up-to-date between the user's Windows machine and their smart phone.

Are you a developer that would like to make it easy for users to manage and synchronize with data stored on your product using the brand new Windows Sync feature? Click the below link and get cracking!

http://msdn.microsoft.com/en-us/library/dd317274(VS.85).aspx - Windows Sync Developer Reference

 

Posted by jomul | 0 Comments
Filed under: , ,

SharePoint 2010, Windows 7 and PwC Now Integrate Microsoft Sync Framework v2.0

As we announced earlier today, Microsoft Sync Framework V2.0 is now available for public download.

Along with this release I wanted to outline a number of companies and partners that are already using Sync Framework v2.0 including Windows 7, Microsoft Office 2010 and PricewaterhouseCoopers (PwC). 

SharePoint has also chosen to integrate Microsoft Sync Framework as part of their solution for synchronizing to Office SharePoint 2010. The SharePoint and Office teams will use the Sync Framework as the engine powering synchronization between Office Workspace (Groove) and SharePoint.  In addition, the SharePoint server will also expose Sync Framework API’s that will allow any developer to build providers to integrate new data stores into SharePoint.

"The Sync Framework will greatly reduce the amount of code that an ISV needs to create, and this represents probably the most painful code that they otherwise would have had to write".
Maxim Lukiyanov, Program Manager SharePoint Server, Microsoft

For more information on this please see our new case study: Microsoft Sync Framework used to Create Microsoft SharePoint Workspace 2010

The Windows 7 Device Stage gives users a common user interface to manage and synchronize data with their Windows 7 enabled phone.  Contacts, calendar, tasks and even notes can be synchronized with any data store. Sync Framework v2.0 is the easiest way for developers to implement data synchronization providers for any store to enable it for the Windows 7 Device synchronization experience.

"The flexibility of Sync Framework and its ability to track and exchange data really set this technology apart.  Since Sync Framework is data agnostic this allowed us to develop a framework tailored around contact, calendar, tasks and notes data". 
Anna Boyd, Windows 7 Engineering, Microsoft

PricewaterhouseCoopers has put a system in deployment for 60,000+ mobile auditors in 150 countries to allow much of their work to be done remotely at the client site, making disconnected, offline use of their application and friction free collaboration across teams. 

"Our implementation of Sync Framework ‘just worked’ for our auditors.  If they set automatic synchronization, our software finds peers, verifies access rights to the same engagement database, and updates all databases.  They might be connected to each other over a client’s network, or just via ad hoc (no access point) WiFi.  If just one laptop has access to the servers, that laptop automatically funnels all changes from the laptops to the server and vice versa.  No manual configuration is needed".
Dr. Glenn Ricart, Technology and Development Leader, PricewaterhouseCoopers

Liam Cavanagh

Sync Framework 2.0 Available for Download

I am happy to announce the availability of Sync Framework 2.0. Sync Framework 2.0 expands on the capabilities offered by Sync Framework 1.0:

  • Adds features that cater to new scenarios or scenarios that were difficult to support.
  • Reduces the amount of work required to develop providers.
  • Supports more data sources with new built-in providers.

The major new features and improvements included in Sync Framework 2.0 are:

In Core Components:

  • Simple Providers: Reduce the amount of work required to develop providers, especially when the data source has very few synchronization-related capabilities, such as change-tracking. The goal is to enable a developer to write a provider without having to become a synchronization expert. The majority of the code that is required for a simple provider is limited to that responsible for interacting with the data source. Simple providers support many complex synchronization scenarios, such as filtering, concurrency and constraint conflict handling, and anchor-based enumeration.
  • Flexible Filtering: Change unit filters and custom filters have been added to the custom provider components. These filters, in addition to the item filters from Sync Framework 1.0, enable you to filter your data in whatever way is most useful. Filter negotiation allows the source and destination providers to negotiate the filter used during the synchronization session. Change unit filters enable a provider to specify that, while the replica it serves stores all items in the synchronization scope, the replica stores a reduced representation of each item. For example, when an item is a contact a device might store only the name and phone number of the contact as compared to the complete contact stored on a PC. Custom filters enable you to define a filter in whatever way is most appropriate, including filters that allow an item to move into or out of the filter as the item data changes. For example, a media storage device stores only songs that are rated as three stars or better. When the rating on a song changes from four stars to two stars, the song moves out of the filter. Filter negotiation allows a destination provider to specify the filter to be used by the source provider during change enumeration; the source provider can accept or reject a filter. If a source provider does not support the requested filter then the destination provider can choose to receive all of the data and do the filtering itself.
  • Improved Conflict Handling: Additional conflict scenarios are supported, such as reporting constraint conflicts, managing logged conflicts, and resolving conflicts by using a last-writer-wins policy. Constraint conflicts are conflicts that violate constraints that are put on items or change units, such as the relationship of folders or the location of identically named data within a file system. Sync Framework includes components to help resolve constraint conflicts and apply the resolution to the destination replica. Conflict logging is enhanced by Sync Framework components that help manage the log, such as by removing obsolete conflicts. A last-writer-wins conflict resolution policy can be used to resolve concurrency conflicts (in which an item is updated by more than one replica) by keeping the most recently made change, regardless of where the change was made. Sync Framework supports this policy by enabling an application to retrieve the time a change was made on the source and destination replicas. The application can then compare the two times and apply the last change.
  • Data Conversion between Providers: In some scenarios, synchronization providers synchronize the same type of data (such as sales data), but the data format that each provider requires is different. To address this scenario, Sync Framework enables you to implement interfaces that convert data to the format that each provider requires. In addition to data conversion APIs that can be used for any type of custom provider, Sync Framework also includes conversion APIs specifically for the file synchronization provider.
  • Change Application Service: Increases the flexibility and usefulness of the change applier component of Sync Framework. By performing the same actions as the standard change applier, but in a more granular way, the change application service gives a destination provider the ability to use only the features that it requires.
  • Tracing: Enables you to trace the execution of several components, which is useful during application debugging. This download provides the .tmf files that can be used to view a trace, flush the logger, and format the binary trace file. For more information about how to trace Sync Framework execution, see “Tracing Sync Framework Components” in the documentation that installs with the Sync Framework SDK.


In Database Providers:

  • New Database Providers (SQL Server and SQL Server Compact): Enable hub-and-spoke and peer-to-peer synchronization for SQL Server, SQL Server Express, and SQL Server Compact. Sync Framework automatically creates all of the commands that are required to communicate with each database. You do not have to write synchronization queries as you do with other providers. The providers support: flexible initialization options; batching of changes based on data size; and maintenance tasks, such as metadata cleanup and server database restore.
  • Robust Memory-Based Batching: Previous versions of Sync Framework and Sync Services for ADO.NET provided a way for developers to define their own batching logic but there were a lot of limitations, including significant complexity, excessive chattiness, out of memory issues, and restrictions on usage. Sync Framework 2.0 addresses all of these issues by providing a more complete and robust batching API. Developers no longer have to write batching logic themselves because Sync Framework divides changes into batches based on several properties in the API. Batches are now defined by memory consumption rather than the number of rows synchronized, which has eliminated out-of-memory issues for most common scenarios.
  • Provisioning and Management APIs: Provisioning and initialization activities that were previously exposed only through Visual Studio tooling have now been added to the database provider APIs. This includes the ability to provision an existing database by adding the change-tracking tables and triggers that are required by Sync Framework. It also includes the ability to start with an empty database, create the user schema, and provision that schema based on another server or client database that has already been provisioned.
  • Performance Improvements: The new database providers in this release have been thoroughly tested in large-scale scenarios in which a single server supports thousands of clients with hundreds of concurrent synchronization operations. This testing resulted in a large number of internal performance improvements that enable Sync Framework database providers to perform as well as other Microsoft technologies like Remote Data Access (RDA) while offering a wide range of capabilities that compete with end-to-end solutions like merge replication.

In File Synchronization Provider:

·          Data Conversion between Providers: The data transfer interface used by the file synchronization provider is now available in managed code. A custom provider that synchronizes some other data type can use the data transfer interface to convert its data to synchronize with a file synchronization provider.

·          Better File Transfer Performance: Improvements to the way file data is copied allow file data to be transferred up to 30% faster than in Sync Framework 1.0.

·          More Robust Synchronization: Instead of failing the entire synchronization session when a single file cannot be synchronized (including failures caused by network issues), the failure is flagged and the synchronization session continues.

To learn more about Sync Framework or to download Sync Framework 2.0, please visit the Sync Framework Developer Center.

Sync Framework and our upcoming conferences

The next few months are going to be very busy for us here in the Sync Framework team.  Not only do we have Sync Framework v2 coming out shortly, we also have a number of conferences where we will talk about the work we have been doing with some of external companies and internal groups here at Microsoft to allow developers to plug-in synchronization to systems like SQL Server and SQL Azure. 

Starting in November, we will be at SQL PASS, and then at the PDC for the launch of SQL Azure.  Last week I recorded a Channel 9 video along with Buck Woody and Michael Rys on the upcoming SQL PASS Summit. You can view the video here:

http://channel9.msdn.com/posts/LarryLarsen/Upcoming-SQL-PASS-Summit-1/

Here is a summary of the video:

Join thousands of SQL Server & BI professionals at the Washington State Convention & Trade Center in Seattle from Nov. 2-5 for the largest SQL Server conference in the world!  PASS Summit offers 168 technical sessions presented by SQL Server experts, one-on-one time with Microsoft’s SQL Server engineering team, free troubleshooting & design architecture guidance from Microsoft consultants, keynotes from Microsoft’s senior executives and much more!

Senior Data Platform Technology Specialist Buck Woody stopped by the Channel 9 studio to talk to Michael Rys, Principal Program Manager in SQL Server Engineering Team, and Liam Cavanagh, Senior Program Manager, about upcoming sessions you won’t want to miss this year’s PASS Summit conference.

Liam Cavanagh

SQL Services is now SQL Azure

I thought I would help get the word out on this one.  Given that we have been spending so much time on Project "Huron", which is a project to enable data synchronization to the cloud where the data store is SQL Data Services SQL Azure Database, I thought you should all be aware of this new branding.  As we announced in the Data Insiders Blog earlier today:

"Effective immediately, SQL Services will be called Microsoft SQL Azure, and SQL Data Services will be Microsoft SQL Azure Database". 

Also, I appologize that I have not provided much of an update on Project "Huron" lately.  We are currently heads down in engineering and working out the specific details of the sync service to be hosted within Azure.  I would like to thank all of you who offered to help us with our Early Adopter Program.  The feedback we have been receiving from you has been absolutely invaluable. 

Liam

Posted by liamca | 0 Comments
Filed under: ,

New Sample - WCF for Devices

Two of our MVPs (José Miguel Torres and Cesar Fong) recently posted an excellent end to end WCF sample for devices that’s worth a look.  They did an excellent job of describing the various components and it is a must see for developers thinking about getting their feet wet building offline applications for Windows Mobile.  Thanks again to Jose and Cesar for contributing these samples to the community!

http://synccomm.codeplex.com/

Regards,

Sean Kelley
Program Manager, Microsoft

More Posts Next page »
 
Page view tracker