locked
Client should win scenario RRS feed

  • Question

  • Hello everyone,

    I make synchronization between to SQL Express DB, one is server other one is client.

    I have next code what make synhronization:

     

    /// <summary>
            /// Sync to Providers
            /// </summary>
            /// <param name="localProvider">can be RelationalProvider Proxy !!! (WCF)</param>
            /// <param name="remoteProvider">RelationalProvider Proxy !!! (WCF)</param>
            /// <param name="syncDirectionOrder"></param>
            /// <returns></returns>
            private SyncOperationStatistics SynchronizeProviders(KnowledgeSyncProvider localProvider, KnowledgeSyncProvider remoteProvider, SyncDirectionOrder syncDirectionOrder)
            {
                localProvider.Configuration.CollisionConflictResolutionPolicy = CollisionConflictResolutionPolicy.RenameDestination;
                localProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.SourceWins;
    
                remoteProvider.Configuration.CollisionConflictResolutionPolicy = CollisionConflictResolutionPolicy.RenameSource;
                remoteProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.DestinationWins;
    
                SubscribeResultEvent(localProvider);
    
                SyncOrchestrator orchestrator = new SyncOrchestrator
                {
                    LocalProvider = localProvider,
                    RemoteProvider = remoteProvider,
                    Direction = syncDirectionOrder
                };
             
                 SyncOperationStatistics stats = orchestrator.Synchronize();
                        return stats;            
            }
    

    I don't know why but my server db is always win,doesn't metter server is localProvider or RemoteProvider, and rewrite client data, but I want to make setting what client is always win.

    But I can't understand how MS Sync Framework do it. 

    What  I need to setup ? 

    thanks !


    • Edited by heppy_aga Thursday, November 24, 2011 4:10 PM not correct title
    Thursday, November 24, 2011 4:10 PM

All replies

  • the RelationalSyncProvider don't use the Configuration property. besides, what would CollisionConflictResolutionPolicy.RenameDestination  and RenameSource mean to a database sync? its mostly used for file syncs.

    see http://msdn.microsoft.com/en-us/library/cc761628(v=SQL.110).aspx on how to handle conflicts. the same stuff is in the documentation that get's installed with the framework.

    Thursday, November 24, 2011 11:53 PM