En este artículo

Synchronizing File Synchronization Provider with Other Providers

07/23/2014

Tiempo de lectura: 2 minutos

En este artículo

This topic describes how to create a managed application that enables a file synchronization provider to synchronize with another Sync Framework provider. In this case the other provider is a simple provider, but you could also use a standard custom provider. For more information about simple providers, see Implementing a Simple Custom Provider.

There are two main requirements for the application:

The application must implement IFileDataRetriever as the data transfer interface between the two providers.

The simple provider must use the same format for IDs that file synchronization provider uses: a 16-byte GUID for replica IDs; A 16 byte GUID that is preceded by an 8-byte prefix for item IDs; and a 4-byte integer for change unit IDs.

Managed Code Examples

The examples in this section show some of the code that is relevant to synchronizing a file synchronization provider and a simple provider, with a focus on the ID and transfer interface requirements. To view this code in the context of a complete application, see the "Sync 101 - Synchronizing a File Synchronization Provider with a Simple Provider" application that is available on Code Gallery.

The following code example shows how the definition of the IdFormats property for the simple provider matches the requirements stated earlier.

The following code example creates the SimpleFileDataRetriever class, which uses AbsoluteSourceFilePath and RelativeDirectoryPath to identify file locations, and FileData and FileStream to transfer the actual data.

The following code example synchronizes the two providers. The synchronization process is the same as if you synchronized two file synchronization providers or two simple providers: implementing the IFileDataRetriever interface and using the appropriate ID formats ensures that data is transferred in the correct way.