WCF同步2.1,触发更新值不同步回

时间:2019-01-11 01:31:43

标签: wcf synchronization

我们刚刚升级为与SQL Server CE 3.5 SP2和SQL Server同步2.1,一切正常,除了一个问题:

当同步数据从客户端更改为SQL Server时,我们在该表上有一个AFTER INSERT, UPDATE触发器来更新称为sync_date的列值,以便将触发器更改后的值恢复为客户端(SQL Server CE 3.5),我尝试了不同的方法,这是几个:

尝试#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();

这是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];
}

它们都不适合我,数据更改可以正确上传,但是触发器更改后的值永远不会回到客户端。

知道我在这里缺少什么吗?请让我知道我还需要提供什么其他代码。

谢谢。

Jerome

0 个答案:

没有答案