public void Upload_Request(SyncOperationContext context)
 {
     // Add a dummy header to the response indicating that the interceptor method was invoked.
     // Note: type casting the context to SyncUploadResponseOperationContext gives you access to the incoming entities and
     // also enables you to reject entities based on custom logic.
     ((SyncUploadRequestOperationContext)context).ResponseHeaders.Add("UploadRequestInterceptorFired", "true");
 }
        /// <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
                };
            }
        }
 /// <summary>
 /// Constructor that uses the FileBasedBatchHandler.
 /// </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>
 internal SqlSyncProviderService(SyncServiceConfiguration configuration, string serverScope, List<SqlSyncProviderFilterParameterInfo> filterParams,
                                 SyncOperationContext operationContext) : this(configuration, serverScope, filterParams, operationContext, null)
 {
 }
 public void Upload_Response(SyncOperationContext context)
 {
     // Add a dummy header to the response indicating that the interceptor method was invoked.
     // Note: type casting the context to SyncUploadResponseOperationContext gives you access to the conflicts and outgoing changes.
     ((SyncUploadResponseOperationContext)context).ResponseHeaders.Add("UploadResponseInterceptorFired", "true");
 }
 public void Download_Request(SyncOperationContext context)
 {
     // Add a dummy header to the response indicating that the interceptor method was invoked.
     context.ResponseHeaders.Add("DownloadRequestInterceptorFired", "true");
 }