In the previous article, we briefly introduced how to use an existing Syncprovider object for file (folder) synchronization. Today's demo mainly demonstrates the inheritance of the implementation of their own syncprovider to carry out the relevant synchronization metadata storage, of course, this will give us additional benefits, such as to create, version and delete items according to their own information, and so on. The other is to have a general idea of how the synchronization application works.
Before I started the text, I read the article on the internet about the coverage of MSF, and of course it said some of the points I agree with. MSF is really not so studious, the official documents are really difficult to understand, but things always have to slowly, only through continuous accumulation of progress, the product will do more and better. Let's make progress together with MSF!
Well, start today's text.
First, explain the interfaces that you want to inherit and implement for the custom Synchronizer ("Mysyncprovider" in this demo):
KnowledgeSyncProvider: A synchronization provider that uses knowledge to perform synchronization
Ichangedataretriever: Represents the mechanism used by the destination provider to retrieve item data from the source provider.
Inotifyingchangeappliertarget: An object that represents an item change that can be saved to a replica
Note: When using the Notifyingchangeapplier object to help apply changes to the destination replica, the destination provider must implement this interface. The Inotifyingchangeappliertarget object is passed to the ApplyChanges method. Then, Notifyingchangeapplier
Object calls the Inotifyingchangeappliertarget method to save the changes and conflicts to the destination replica.
The KnowledgeSyncProvider method defines the following main methods:
BeginSession When overridden in a derived class, notifies the provider that it will join a synchronization session.
EndSession When overridden in a derived class, notifies the provider that the synchronization session it is registering to has completed.
GetChangeBatch When overridden in a derived class, gets the batch of changes that contain item metadata for some items that are not included in the specified knowledge from the destination provider.
GetFullEnumerationChangeBatch When overridden in a derived class, gets the change batch that is part of a full enumeration that contains item metadata for an item with an ID greater than the specified lower bound.
GetSyncBatchParameters When overridden in a derived class, gets the number of item changes to include in the change batch, and the current knowledge of the synchronization scope.
ProcessChangeBatch When overridden in a derived class, handles a change group by detecting conflicts and applying changes to the item store.
ProcessFullEnumerationChangeBatch When overridden in a derived class, processes a change group to be used for full enumeration by applying the change to the item store.