共用方式為


Converting IDs and Items for RSS and Atom Feeds

In creating an application that produces or consumes an RSS or Atom feed, most of the work is in converting IDs and item data between the XML format of the FeedSync feed and the format of the synchronization provider.

Converting IDs

The application must implement an ID converter object that can convert replica IDs and item IDs from the flexible-length format of the provider to strings, and vice versa. Also, the ID converter must be able to generate a replica ID for an anonymous change. An anonymous change occurs when the FeedSync history for a change does not include a by value. The by attribute represents the replica that made the change. However, the by attribute is not required by the FeedSync schema and might be absent. In this case, a replica ID must be generated for the change by combining the sequence and when values of the change.

Managed code To convert IDs, an application implements a FeedIdConverter object.

Unmanaged code To convert IDs, an application implements an IFeedIdConverter object.

Converting Item Data

The application must implement an item converter object that can convert item data from the format of the local provider to the XML format of the feed, and vice versa. The XML data can be represented either as an XML node structure or as a string. In either case, it is up to the application to ensure that the XML format is valid for the feed, because Sync Framework does not perform any validity checks.

Managed code To convert item data, an application implements a FeedItemConverter object. This object must provide data in the format the local provider expects to find in the ChangeData property of the SaveChangeContext object that is sent to the SaveItemChange(SaveChangeAction, ItemChange, SaveChangeContext) method.

Unmanaged code To convert item data, an application implements an IFeedItemConverter object. This object must provide data in the format the local provider expects to get from the ISaveChangeContext::GetChangeData method of the ISaveChangeContext object sent to the ISynchronousNotifyingChangeApplierTarget::SaveChange method.

請參閱

參考

Microsoft.Synchronization.FeedSync

FeedIdConverter

FeedItemConverter

概念

Synchronizing Web Feeds

Sync Framework Web Synchronization Components

其他資源

IFeedIdConverter interface

IFeedItemConverter interface