如何在基于时间戳的同步的同步服务中处理冲突解决拦截器

时间:2011-10-19 12:48:04

标签: c#

请参阅此代码并告诉我基于时间戳的同步的任何建议 当客户端和服务器数据库中的特定表中的特定记录的数据发生更改时。在同步后,会出现冲突。那时我需要基于时间戳的同步。

有可能吗?

如果有可能建议我..

提前致谢...

#region SyncService: Configuration and setup
public class DefaultScopeSyncService : Microsoft.Synchronization.Services.SyncService<DefaultScopeOfflineEntities> {
    public static void InitializeService(Microsoft.Synchronization.Services.ISyncServiceConfiguration config) {
        config.ServerConnectionString = ConfigurationManager.ConnectionStrings["ListDbConnectionString"].ToString();
        config.SetEnableScope("DefaultScope");
        config.AddFilterParameterConfiguration("userid", "User", "@ID", typeof(System.Guid));
        config.AddFilterParameterConfiguration("userid", "List", "@UserID", typeof(System.Guid));

        config.UseVerboseErrors = true;
        config.EnableDiagnosticPage = true;
    }


    [SyncConflictInterceptor("DefaultScope",EntityType=typeof(LookupType))]
    public SyncConflictResolution ConflictHandler(SyncConflictContext context, out IOfflineEntity mergedEntity)
    {
        context.ResponseHeaders.Add("ConflictInterceptorFired", "true");
        mergedEntity = null;
        return SyncConflictResolution.Merge;
    }
}
#endregion

0 个答案:

没有答案