none
wcf sync 2.1 issue, trigger changed data not synced. RRS feed

  • Question

  • We just upgraded to sync 2.1 with sqlce 3.5 SP2 and SQL Server, everything works fine except one issue:

    When sync data change from client to sql server, we have a 'after Insert, Update' trigger on the table to update a column value which is called 'sync_date', in order to get the trigger changed value back to the client side (sqlce 3.5), I tried different ways, here's a couple:

    1. 

    var scope = string.Format("{0}-{1}", CommonStaticConstants.COMMON_SCOPE_BIDIRECTION, auth.ApplicationUser);
    GetOrchestrator(auth, GetMachineNames(auth.ApplicationUser), scope, SyncDirectionOrder.UploadAndDownload, false).Synchronize();

    2.

    var scope = string.Format("{0}-{1}", CommonStaticConstants.COMMON_SCOPE_BIDIRECTION, auth.ApplicationUser);
    GetOrchestrator(auth, GetMachineNames(auth.ApplicationUser), scope, SyncDirectionOrder.Upload, false).Synchronize();
    GetOrchestrator(auth, GetMachineNames(auth.ApplicationUser), scope, SyncDirectionOrder.Download, false).Synchronize();

    Here's the logic of GetOrchestrator():

    private static SyncOrchestrator GetOrchestrator(LoginAuthenticator auth, string machineNames, string scopeName, SyncDirectionOrder direction, bool isRescopingRequired)
            {
                if (!orchestratorMap.Keys.Contains(scopeName) || isRescopingRequired)
                {
                    var destinationProxy = new SqlSyncProviderProxy(auth, machineNames, scopeName, isRescopingRequired);

                    orchestrator = new SyncOrchestrator();
                    var localProvider = new SqlCeSyncProvider();
                    localProvider.ScopeName = scopeName;
                    localProvider.Connection = new SqlCeConnection(Infrastructure.ConnectionManager.GetClientDbConnection());
                    localProvider.ApplyChangeFailed += OnApplyChangeFailed;
                    
                    orchestrator.LocalProvider = localProvider;
                    orchestrator.RemoteProvider = destinationProxy;
                    orchestrator.Direction = direction;

                    CheckIfProviderNeedsSchema((SqlCeSyncProvider)orchestrator.LocalProvider, auth, machineNames, isRescopingRequired);

                    if (orchestratorMap.Keys.Contains(scopeName))
                    {
                        orchestratorMap.Remove(scopeName);
                    }
                    orchestratorMap.Add(scopeName, orchestrator);
                }

                orchestratorMap[scopeName].Direction = direction;

                return orchestratorMap[scopeName];
            }

    none of them works for me, data change can be uploaded correctly, but trigger changed value never came back to client side.

    Any idea what I'm missing here? Please let me know what other code pieces I need to provide.

    Thanks in advance.

    Jerome


    • Edited by lzhwxy Saturday, January 12, 2019 12:33 AM
    Friday, January 11, 2019 5:20 PM