title: Sync direction not working as expected
body: <p>I have a project that uses Microsoft Sync Framework. Everything is working fine except the Sync direction. I set the Sync direction of the Synch Orchestrator depending on the user's choice if it will be Upload or Download. </p>
  
  <p>Edit:</p>
  
  <p>I have uploaded a document to better explain the situation:</p>
  
  <p><a href="https://docs.google.com/file/d/0BzNIZTJXVnAWbVZSWU5mNEx3eFk/edit?usp=sharing" rel="nofollow">google doc link</a></p>
  
  <p>Code:</p>
  
  <pre><code>private void RunSynch()
  {
      SqlConnection sqlServer = new SqlConnection(GetServerConnectionString());
      SqlConnection sqlClient = new SqlConnection(GetClientConnectionString());
  
      SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
      syncOrchestrator.LocalProvider = new SqlSyncProvider(strScopeName, sqlClient);
      syncOrchestrator.RemoteProvider = new SqlSyncProvider(strScopeName, sqlServer); 
  
      switch(iButtonState) // int constant
      {
          case STATE_UPLOAD:
  
              syncOrchestrator.Direction = SyncDirectionOrder.Upload;
              break;
  
          case STATE_DOWNLOAD:
  
              syncOrchestrator.Direction = SyncDirectionOrder.Download;
              break;
      }
  
      ((SqlSyncProvider)syncOrchestrator.RemoteProvider).ApplyChangeFailed += new EventHandler&lt;DbApplyChangeFailedEventArgs&gt;(RemoteProvider_ApplyChangeFailed);
      ((SqlSyncProvider)syncOrchestrator.LocalProvider).ApplyChangeFailed += new EventHandler&lt;DbApplyChangeFailedEventArgs&gt;(LocalProvider_ApplyChangeFailed);
  
      syncStats = syncOrchestrator.Synchronize();
  }
  
  
  
  private void RemoteProvider_ApplyChangeFailed(object sender, DbApplyChangeFailedEventArgs e)
  {
  
      if (rdoConflict.SelectedIndex == 0)// server wins option
      {
          e.Action = ApplyAction.Continue;
      }
      else
      {
          e.Action = ApplyAction.RetryWithForceWrite;
      }
  }
  
  private void LocalProvider_ApplyChangeFailed(object sender, DbApplyChangeFailedEventArgs e)
  {
      if (rdoConflict.SelectedIndex == 0) // server wins option
      {
          e.Action = ApplyAction.RetryWithForceWrite;
      }
      else
      {
          e.Action = ApplyAction.Continue;
      }
  }
  </code></pre>
  
  <p>The problem here is the server database gets updated by the clients changes even if the synch direction is only Download.</p>
  
  <p>Fixed:</p>
  
  <p>I got it finally working now. There was totally no issue with the synch framework but its the switch part where the Direction is assigned, I debugged and found out that the program doesnt go through the switch case thats why the direction is always bi-directional.</p>