protected virtual void OnSynchronized(object sender, DbSynchronizedEventArgs ev) { if (Synchronized != null) { Synchronized(sender, ev); } }
protected override void SynchronizeSyncScope(string syncScope, SyncDirectionOrder synDirection, KnowledgeSyncProvider localProvider, KnowledgeSyncProvider remoteProvider) { // Create the sync orchestrator SyncOrchestrator orchestrator = new SyncOrchestrator(); // Set local provider of orchestrator to a sync provider associated with the sync scope in the client database orchestrator.LocalProvider = localProvider; // Set remote provider of orchestrator to a sync provider associated with the sync scope in the server database orchestrator.RemoteProvider = remoteProvider; // Set the direction of sync session orchestrator.Direction = synDirection; // Use sync-callbacks for conflicting items SyncCallbacks destCallbacks = ((KnowledgeSyncProvider)orchestrator.RemoteProvider).DestinationCallbacks; destCallbacks.ItemConflicting += new EventHandler <ItemConflictingEventArgs>(OnItemConfliting); destCallbacks.ItemConstraint += new EventHandler <ItemConstraintEventArgs>(OnItemConstraint); // Subcribe for errors that occur when applying changes to the client ((SqlSyncProvider)orchestrator.LocalProvider).ApplyChangeFailed += new EventHandler <DbApplyChangeFailedEventArgs>(OnApplyChangeFailed); ((SqlSyncProvider)orchestrator.LocalProvider).ChangesApplied += new EventHandler <DbChangesAppliedEventArgs>(OnChangesApplied); // Execute the synchronize process SyncOperationStatistics syncStats = orchestrator.Synchronize(); // Notify a synchronization took place DbSynchronizedEventArgs ev = new DbSynchronizedEventArgs(syncStats); OnSynchronized(orchestrator, ev); destCallbacks.ItemConflicting -= new EventHandler <ItemConflictingEventArgs>(OnItemConfliting); destCallbacks.ItemConstraint -= new EventHandler <ItemConstraintEventArgs>(OnItemConstraint); ((SqlSyncProvider)orchestrator.LocalProvider).ApplyChangeFailed -= new EventHandler <DbApplyChangeFailedEventArgs>(OnApplyChangeFailed); }
public abstract void RemoveDbSynchronized(object sender, DbSynchronizedEventArgs ev);