none
How to force a SyncFramework FULL Syncronisation RRS feed

  • Question

  • I have two Databases (Local one and the Central one).
    Now in my case I just want to have the Central Database Syncronised with the Local one, which means Central --> Local

    This is working without any problems. But if somebody changes something on the Local DB, but nothing has been changed on Central DB,
    I have seen that this modified row on the Local one will not be updated with the old settings from the Central Database.

    How can I configure or trigger a Full Sync, independed if something has changed on Central DB. Can somebody give me a hint?
    Thanks.

    Wednesday, July 20, 2011 2:20 PM

All replies

  • which provider are you using?
    Wednesday, July 20, 2011 2:47 PM
    Moderator
  • I am using the following code (snippet):

                SqlConnection clientConn = new SqlConnection(sourcedbname);
                SqlConnection serverConn = new SqlConnection(targetdbname);

                SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
                syncOrchestrator.LocalProvider = new SqlSyncProvider(scopename, clientConn);
                syncOrchestrator.RemoteProvider = new SqlSyncProvider(scopename, serverConn);

                if (direction == "Upload")
                {
                    syncOrchestrator.Direction = SyncDirectionOrder.Upload;
                }
                else if (direction == "Download")
                {
                    syncOrchestrator.Direction = SyncDirectionOrder.Download;
                }
             

                ((SqlSyncProvider)syncOrchestrator.LocalProvider).ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(Program_ApplyChangeFailed);
                ((SqlSyncProvider)syncOrchestrator.RemoteProvider).ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(Program_ApplyChangeFailed);

                try
                {
                   
                    SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
                }
                catch (Exception e)
                {
                }
                serverConn.Close();
                serverConn.Dispose();
                clientConn.Close();
                clientConn.Dispose();
            }

    Thursday, July 21, 2011 7:48 AM
  • the easiest is to deprovision the scope on the client, delete the records and re-provision the scope.

    if you deprovision/reprovision without deleting the client rows, the new download would fire conflicts as the rows already exists and will slow down the first sync even if you do conflict handling.

    if you dont have that many clients, the other approach would be doing a dummy update (update tablex set col1=col1) on the server which will increment their timestamps and subsequently get picked up in the next sync.

    Thursday, July 21, 2011 9:29 AM
    Moderator