private void synchronizeBtn_Click(object sender, EventArgs e) { //Before calling synchronize, save any changes made to any of the peer tables //foreach (TabPage page in this.peerTabsControl.TabPages) //{ // if (page != null) // { // ((TablesViewControl)page.Controls["TablesViewCtrl"]).UpdateValues(); // } //} RelationalSyncProvider srcProvider = providersCollection[this.srcProviderComboBox.SelectedItem.ToString()]; RelationalSyncProvider destinationProvider = providersCollection[this.destProviderComboBox.SelectedItem.ToString()]; //Set memory data cache size property. 0 represents non batched mode srcProvider.MemoryDataCacheSize = this._batchSize; destinationProvider.MemoryDataCacheSize = this._batchSize; //Set batch spool location. Default value if not set is %Temp% directory. if (!string.IsNullOrEmpty(this.batchSpoolLocation.Text)) { srcProvider.BatchingDirectory = this.batchSpoolLocation.Text; destinationProvider.BatchingDirectory = this.batchSpoolLocation.Text; } SyncOperationStatistics stats = synchronizationHelper.SynchronizeProviders(srcProvider, destinationProvider); TimeSpan diff = stats.SyncEndTime.Subtract(stats.SyncStartTime); //Print Sync stats object this.syncStats.Text = string.Format("Batching: {4} - Total Time To Synchronize = {0}:{1}:{2}:{3}", diff.Hours, diff.Minutes, diff.Seconds, diff.Milliseconds, (this._batchSize > 0) ? "Enabled" : "Disabled"); this.ReadTableValuesForSelectedTab(); }
private void synchronizeBtn_Click(object sender, EventArgs e) { //Before calling synchronize, save any changes made to any of the peer tables foreach (TabPage page in this.peerTabsControl.TabPages) { if (page != null) { ((TablesViewControl)page.Controls["TablesViewCtrl"]).UpdateValues(); } } SqlSyncProvider srcProvider = providersCollection[this.srcProviderComboBox.SelectedItem.ToString()]; SqlSyncProvider destinationProvider = providersCollection[this.destProviderComboBox.SelectedItem.ToString()]; string hostName = ((SqlConnection)destinationProvider.Connection).DataSource; SqlSyncProviderProxy destinationProxy = new SqlSyncProviderProxy( SyncUtils.ScopeName, ((SqlConnection)destinationProvider.Connection).ConnectionString); //Set memory data cache size property. 0 represents non batched mode srcProvider.MemoryDataCacheSize = this._batchSize; //No need to set memory cache size for Proxy as since the source is enabled for batching, both upload and download will //be batched. //Set batch spool location. Default value if not set is %Temp% directory. if (!string.IsNullOrEmpty(this.batchSpoolLocation.Text)) { srcProvider.BatchingDirectory = this.batchSpoolLocation.Text; destinationProxy.BatchingDirectory = this.batchSpoolLocation.Text; } SyncOperationStatistics stats = synchronizationHelper.SynchronizeProviders(srcProvider, destinationProxy); TimeSpan diff = stats.SyncEndTime.Subtract(stats.SyncStartTime); destinationProxy.Dispose(); //Print Sync stats object this.syncStats.Text = string.Format("Batching: {4} - Total Time To Synchronize = {0}:{1}:{2}:{3}", diff.Hours, diff.Minutes, diff.Seconds, diff.Milliseconds, (this._batchSize > 0) ? "Enabled" : "Disabled"); this.ReadTableValuesForSelectedTab(); }