SyncAgent.Synchronize 方法
在本地和远程数据存储之间同步数据。
命名空间: Microsoft.Synchronization
程序集: Microsoft.Synchronization.Data(在 microsoft.synchronization.data.dll 中)
语法
声明
Public Function Synchronize As SyncStatistics
用法
Dim instance As SyncAgent
Dim returnValue As SyncStatistics
returnValue = instance.Synchronize
public SyncStatistics Synchronize ()
public:
SyncStatistics^ Synchronize ()
public SyncStatistics Synchronize ()
public function Synchronize () : SyncStatistics
返回值
一个 SyncStatistics 对象,其中包含同步会话的统计信息。
示例
下面的代码示例调用派生自 SyncAgent 的类的 Synchronize 方法,然后将信息写到控制台。若要在完整示例上下文中查看此代码,请参见入门:客户端与服务器同步。
SampleSyncAgent sampleSyncAgent = new SampleSyncAgent();
SyncStatistics syncStatistics = sampleSyncAgent.Synchronize();
Console.WriteLine("Start Time: " + syncStatistics.SyncStartTime);
Console.WriteLine("Total Changes Downloaded: " + syncStatistics.TotalChangesDownloaded);
Console.WriteLine("Complete Time: " + syncStatistics.SyncCompleteTime);
Console.WriteLine(String.Empty);
Dim sampleSyncAgent As New SampleSyncAgent()
Dim syncStatistics As SyncStatistics = sampleSyncAgent.Synchronize()
Console.WriteLine("Start Time: " & syncStatistics.SyncStartTime)
Console.WriteLine("Total Changes Downloaded: " & syncStatistics.TotalChangesDownloaded)
Console.WriteLine("Complete Time: " & syncStatistics.SyncCompleteTime)
Console.WriteLine(String.Empty)