INotifyingChangeApplierTarget::StoreKnowledgeForScope Method

When overridden in a derived class, stores the knowledge for the current scope.

Namespace:  Microsoft.Synchronization
Assembly:  Microsoft.Synchronization (in Microsoft.Synchronization.dll)

void StoreKnowledgeForScope(
	SyncKnowledge^ knowledge, 
	ForgottenKnowledge^ forgottenKnowledge
)

Parameters

knowledge
Type: Microsoft.Synchronization::SyncKnowledge
The updated knowledge to be saved.
forgottenKnowledge
Type: Microsoft.Synchronization::ForgottenKnowledge
The forgotten knowledge to be saved.

knowledge must replace the existing knowledge for the scope. forgottenKnowledge must also replace the forgotten knowledge for the scope. Sync Framework calls this method one time per change batch after all changes in the change batch have been processed.

The following example implements the StoreKnowledgeForScope method. The example stores the knowledge and forgotten knowledge in the destination replica. Because this method is called one time after each change batch is processed, it can be useful to take additional actions here. This example commits item store and metadata store changes that were made during processing of the change batch.

Public Sub StoreKnowledgeForScope(ByVal knowledge As SyncKnowledge, ByVal forgottenKnowledge As ForgottenKnowledge) Implements INotifyingChangeApplierTarget.StoreKnowledgeForScope
    ' Use the metadata storage service to save the knowledge and forgotten knowledge.
    _ContactStore.ContactReplicaMetadata.SetKnowledge(knowledge)
    _ContactStore.ContactReplicaMetadata.SetForgottenKnowledge(forgottenKnowledge)

    ' Commit changes made to the in-memory item store to the file on disk.
    _ContactStore.SaveContactChanges()

    ' Commit changes made to the in-memory metadata store to the file on disk.
    _ContactStore.SaveMetadataChanges()
End Sub


public void StoreKnowledgeForScope(SyncKnowledge knowledge, ForgottenKnowledge forgottenKnowledge)
{
    // Use the metadata storage service to save the knowledge and forgotten knowledge.
    _ContactStore.ContactReplicaMetadata.SetKnowledge(knowledge);
    _ContactStore.ContactReplicaMetadata.SetForgottenKnowledge(forgottenKnowledge);

    // Commit changes made to the in-memory item store to the file on disk.
    _ContactStore.SaveContactChanges();

     // Commit changes made to the in-memory metadata store to the file on disk.
    _ContactStore.SaveMetadataChanges();
}


Show: