Search code examples
c#sql-serversynchronizationmicrosoft-sync-framework

How to specify SyncDirectionOrder by Table using SyncOrchestrator


I have separated the tables into a different scopes with different SyncDirectionOrder because I have not figured out how to do it using a single scope:

public void Sync()
{
    Sync("BidirectionalScope", SyncDirectionOrder.DownloadAndUpload);
    Sync("UploadScope", SyncDirectionOrder.Upload);
    Sync("DownloadScope", SyncDirectionOrder.Download);
} 

protected SyncOperationStatistics Sync(string syncScope, SyncDirectionOrder syncDirectionOrder)
{
    var localProvider = new SqlSyncProvider(...);
    var remoteProvider = new SqlSyncProvider(...);

    var syncOrchestrator = new SyncOrchestrator
    {
        LocalProvider = localProvider,
        RemoteProvider = remoteProvider,
        Direction = syncDirectionOrder
    };

    return syncOrchestrator.Synchronize();
}

Solution

  • you cant, using the Syncorchestrator, the scope is the only place you can specify the sync direction.