Sdílet prostřednictvím


Implementing a Simple Custom Provider

Sync Framework offers APIs that range from domain specific, such as the file synchronization provider, to the open-ended core APIs that can enable synchronization for any type of data store. The simple provider APIs are in the middle of this spectrum. They give developers a lot of the power and flexibility of the core APIs, but with less of a learning curve and less code, especially for replicas that have little or no change-tracking support. The simple provider API is extensible, but it is designed primarily for two types of replicas:

  • Replicas that do not support any kind of change tracking. This type of replica uses a full enumeration provider, which enumerates all items from the source replica every time synchronization occurs.

  • Replicas that support anchor-based change tracking. This type of replica uses an anchor-based provider, which enumerates the items from the source replica that changed after a specific anchor was set, which is typically a point in time.

For more information about custom providers, see Custom Provider Fundamentals, especially the section "Deciding Between a Simple Provider and a Standard Provider".

Primary Interfaces and Important Options

Simple provider interfaces are available in managed code and native code. Managed code is in the Microsoft.Synchronization.SimpleProviders namespace in Microsoft.Synchronization.SimpleProviders.dll; for more information, see Microsoft.Synchronization.SimpleProviders. Native code is in providerframework.dll, and requires anchorenumerationprovider.h and fullenumerationprovider.h; for more information, see Sync Framework Simple Provider Components.

The primary interfaces for simple providers are as follows:

Managed Interfaces Unmanaged Interfaces

FullEnumerationSimpleSyncProvider

IFullEnumerationSyncProvider Interface

AnchorEnumerationSimpleSyncProvider

IAnchorSyncProvider Interface

FullEnumerationContext

IFullEnumerationCallback Interface

AnchorEnumerationContext

IAnchorChangeDetectionCallback Interface

ItemEnumerationContext

 

The provider interfaces are implemented by the developer. Provider methods, such as the managed UpdateItem or the unmanaged UpdateItem are called by the Sync Framework runtime during each synchronization session to select and apply changes. For each of these methods, you must write an implementation that is specific to the replica, item store, and application needs. For example, the update method must be able to perform an update in the destination data store and enforce or respond appropriately to any business logic that your application requires for updates. The context and callback interfaces are implemented by Sync Framework and provide a way to access synchronization session context. In addition to the primary interfaces, the simple provider API includes important options in the following areas:

For more information about design considerations when creating a simple provider, see Considerations for Simple Custom Provider Design.

For more information about creating a managed simple provider, see How to: Create a Managed Simple Provider.

See Also

Reference

Microsoft.Synchronization.SimpleProviders

Concepts

Synchronizing Data Stores by Using Custom Providers
What's New in Sync Framework 2.0
Sync Framework Simple Provider Components