我有一个 SQL Express 数据库作为本地服务器,还有一个 SQL Server 数据库作为远程服务器。我正在使用 SyncOrchestrator 同步代理进行冲突解决。每当出现冲突时,我希望将其存储起来,以便稍后获取所有冲突并逐个解决。但是 ApplyAction 枚举没有类似于 "SkipChange" 或 "Defer" 的任何值。
请指导。
以下是代码: private void btnSync_Click(object sender, RoutedEventArgs e) { SqlConnection clientConn = new SqlConnection(connectionstring1); }
请指导。
以下是代码: private void btnSync_Click(object sender, RoutedEventArgs e) { SqlConnection clientConn = new SqlConnection(connectionstring1); }
SqlConnection serverConn = new SqlConnection(connectionstring2);
// create the sync orhcestrator
SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
SqlSyncProvider localProvider = new SqlSyncProvider("Scope1", clientConn);
SqlSyncProvider remoteProvider = new SqlSyncProvider("Scope2", serverConn);
// set local provider of orchestrator to a sync provider associated with the
// ProductsScope in the SyncExpressDB express client database
syncOrchestrator.LocalProvider = localProvider;
// set the remote provider of orchestrator to a server sync provider associated with
// the ProductsScope in the SyncDB server database
syncOrchestrator.RemoteProvider = remoteProvider;
// set the direction of sync session to Upload and Download
syncOrchestrator.Direction = SyncDirectionOrder.DownloadAndUpload;
// subscribe for errors that occur when applying changes to the client
((SqlSyncProvider)syncOrchestrator.LocalProvider).ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(Program_ApplyChangeFailed);
// execute the synchronization process
SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
MessageBox.Show("Synchronization of Table1 Completed");
BindClientTables();
BindServerTables();
}
private void btnServerData_Click(object sender, RoutedEventArgs e)
{
BindServerTables();
}
private void btnClientData_Click(object sender, RoutedEventArgs e)
{
BindClientTables();
}
static void Program_ApplyChangeFailed(object sender, DbApplyChangeFailedEventArgs e)
{
"**Here I want to defer the Resolution for future.**"
}