public SyncConflictResolution ConflictHandler(SyncConflictContext context, out IOfflineEntity mergedEntity) { // Add a dummy header to the response indicating that the interceptor method was invoked. context.ResponseHeaders.Add("ConflictInterceptorFired", "true"); // The mergedEntity is used as the winner of the conflict // when this method returns SyncConflictResolution.Merge as the resolution. // For other resolutions such as SyncConflictResolution.ClientWins and SyncConflictResolution.ServerWins // the mergedEntity should be set to null. mergedEntity = null; return(SyncConflictResolution.ClientWins); }
/// <summary> /// Creates a new instance of the <see cref="SqlSyncProviderService" /> class. Also uses the batch handler passed as parameter if it is not null. /// </summary> /// <param name="configuration">Sync configuration</param> /// <param name="serverScope">Server scope/template</param> /// <param name="filterParams">Filter parameters. Pass null for no filter parameters.</param> /// <param name="operationContext">SyncOperationContext object to create the SyncConflictContext object.</param> /// <param name="batchHandler">Batch Handler for spooling and retrieving batches.</param> internal SqlSyncProviderService(SyncServiceConfiguration configuration, string serverScope, List<SqlSyncProviderFilterParameterInfo> filterParams, SyncOperationContext operationContext, IBatchHandler batchHandler) { WebUtil.CheckArgumentNull(serverScope, "serverScope"); _configuration = configuration; _serverConnectionString = _configuration.ServerConnectionString; _scopeName = serverScope; _conflictResolutionPolicy = _configuration.ConflictResolutionPolicy; _filterParams = filterParams; _converter = new DataSetToEntitiesConverter(_configuration.TableGlobalNameToTypeMapping, _configuration.TypeToTableGlobalNameMapping, _configuration.TypeToTableLocalNameMapping); _batchHandler = batchHandler ?? new FileBasedBatchHandler(_configuration.BatchSpoolDirectory); if (operationContext != null) { _conflictContext = new SyncConflictContext() { ScopeName = serverScope, Operation = SyncOperations.Upload, RequestHeaders = operationContext.RequestHeaders, ResponseHeaders = operationContext.ResponseHeaders, QueryString = operationContext.QueryString }; } }