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 命名空间