3

我有一个 SQL Express DB 作为本地服务器和一个 SQL Server DB 作为远程服务器。我正在使用 SyncOrchestrator 同步代理来解决冲突。无论有冲突,我都想存储它,以便以后我得到所有的冲突并一一解决。但是 ApplyAction 枚举没有像“SkipChange”或“Defer”这样的值。

请指导。

代码粘贴在下面。

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.**"
        }
4

1 回答 1

0

如果要跳过,则应将 RetryNextSync 指定为操作...

我建冲突...

于 2012-12-12T14:02:14.667 回答