共用方式為


INotifyingChangeApplierTarget.StoreKnowledgeForScope 方法

在衍生類別中覆寫時,會儲存目前範圍的知識。

命名空間: Microsoft.Synchronization
組件: Microsoft.Synchronization (在 microsoft.synchronization.dll)

語法

'宣告
Sub StoreKnowledgeForScope ( _
    knowledge As SyncKnowledge, _
    forgottenKnowledge As ForgottenKnowledge _
)
'用途
Dim instance As INotifyingChangeApplierTarget
Dim knowledge As SyncKnowledge
Dim forgottenKnowledge As ForgottenKnowledge

instance.StoreKnowledgeForScope(knowledge, forgottenKnowledge)
void StoreKnowledgeForScope (
    SyncKnowledge knowledge,
    ForgottenKnowledge forgottenKnowledge
)
void StoreKnowledgeForScope (
    SyncKnowledge^ knowledge, 
    ForgottenKnowledge^ forgottenKnowledge
)
void StoreKnowledgeForScope (
    SyncKnowledge knowledge, 
    ForgottenKnowledge forgottenKnowledge
)
function StoreKnowledgeForScope (
    knowledge : SyncKnowledge, 
    forgottenKnowledge : ForgottenKnowledge
)

參數

  • knowledge
  • forgottenKnowledge
    要儲存的被遺忘知識。

備註

knowledge 必須取代此範圍的現有知識。forgottenKnowledge 也必須取代此範圍的被遺忘知識。在處理變更批次中的所有變更之後,Sync Framework 就會針對每個變更批次呼叫這個方法一次。

範例

下列範例會實作 StoreKnowledgeForScope 方法。此範例會將知識和被遺忘知識儲存在目的地複寫中。因為這個方法會在處理每個變更批次之後呼叫一次,所以在此採取其他動作可能會很有用。這則範例會認可在處理變更批次期間所進行的項目存放區和中繼資料存放區變更。

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();
}

請參閱

參考

INotifyingChangeApplierTarget 介面
INotifyingChangeApplierTarget 成員
Microsoft.Synchronization 命名空間