title: Synchronizing Relative tables in Sync Framework 2.1
body: <p>I am trying to synchronize Sql Express 2008 with Sql Compact 3.5 with help of Sync Framework 2.1</p>
  
  <p>I have 2 tables </p>
  
  <ul>
  <li>Customers(PK Id , string Name )</li>
  <li>Orders (PK Id , int Price , string
  Name , FK Customer_Id)</li>
  </ul>
  
  <p>I Use the following code </p>
  
  <pre><code>public static void CreateScope(string userName)
  {
  var serverConn = new SqlConnection(@"Data Source=.\SQLEXPRESS; Initial Catalog=Test; Integrated Security=True");
  
  var scopeDescription = new DbSyncScopeDescription(string.Format("Customer-{0}", userID));
  
  var customersTable = SqlSyncDescriptionBuilder.GetDescriptionForTable("Customers", serverConn);
  var ordersTable = SqlSyncDescriptionBuilder.GetDescriptionForTable("Orders", serverConn);
  
  ordersTable.Constraints.Add("FK_Customer_Id", "Customers", "Orders", "Id", "Customer_Id");
  
  scopeDesc.Tables.Add(azmanotTable);
  scopeDesc.Tables.Add(customersTable);
  
  var serverProvision = new SqlSyncScopeProvisioning(serverConn, scopeDesc);
  serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);
  
  serverProvision.Tables["Customers"].AddFilterColumn("CustumerName");
  serverProvision.Tables["Customers"].FilterClause = string.Format("[side].[CustumerName] = '{0}'", userName);
  
  serverProvision.Apply();
  }
  </code></pre>
  
  <p>During the Sync I do receive filtered "Customers" table <strong>but</strong> i also receive full orders table when i wanted only subset of this data , I  mean only orders that belong to specific customer.</p>
  
  <p>I have tried all the options i found in web for example to change insert order adding foreign key manually but still no success.</p>
  
  <p>Thanks in Advance</p>