使用 ISync.NET API 的简单示例应用程序

本主题包括提供如何使用 ISync.NET API 的快速参考的示例。

// Synchronization properties
private Hashtable userProps = new Hashtable();
 
// Get an instance DB2eISyncProvider 
ISyncProvider provider = DB2eISyncProvider.GetInstance();
 
// Set up properties
userProps.Add("isync.user", username);
userProps.Add("isync.password", password);
 
// Get an instance of synchronization service from the provider
ISyncService service = provider.CreateSyncService(http://localhost:80, userProps);
 
// Get an instance of the configuration store
ISyncConfigStore config = service.GetConfigStore(data);
 
// Get an instance of the sync driver to perform synchronization
ISyncDriver syncer = config.GetSyncDriver(); 
    
// Perform synchronization
syncer.Sync();
 
// Close objects
syncer.Close();
config.Close();
service.Close();

相关概念

相关任务