Synchronize Call fails with ObjectSchema RRS feed

  • Question

  • I have the following code


              foreach (string table in tableList) {
                string scopeName = dbName + "-" + table + "-" + "Scope";
                Console.WriteLine("Going to synchronize " + scopeName);
                SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
                syncOrchestrator.LocalProvider = new SqlSyncProvider(scopeName, localServerCon);
                syncOrchestrator.RemoteProvider = new SqlSyncProvider(scopeName, serverCon);
                syncOrchestrator.Direction = SyncDirectionOrder.DownloadAndUpload;
                SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();

    This code fails when at the time of provisioning, I had specified on ObjectSchema on the SqlSyncScopeProvisioning object.

    When I comment out the ObjectSchema line and re-provision my databases, the sync works perfectly. Can you please tell me how can I synchronize correct when the database sync was provisioned using ObjectSchema?


    Monday, February 28, 2011 1:26 PM


  • you can set the ObjectSchema on the SQLSyncProvider to the same ObjectSchema value you used when provisioning


    var localSQLProvider = new SqlSyncProvider(scopeName, localServerCon);
    localSQLProvider.ObjectSchema = <some schema value>;

    if am not mistaken, there is also a constructor for SQLSyncProvider that takes the scopename, connection, object prefix and object schema: new SqlSyncProvider(scopeName, serverCon, yourobjectprefix, yourobjectschema);

    • Marked as answer by MSDN Student Tuesday, March 1, 2011 2:08 AM
    Monday, February 28, 2011 2:09 PM