Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. public string DefiningScopeAndProvisioningServer(string conSQL, string tableName, string type)
  2. {
  3. try
  4. {
  5. string[] splitString = null;
  6. splitString = tableName.Split('|');
  7.  
  8. SqlConnection con = new SqlConnection(conSQL);
  9. foreach (string _tableName in splitString)
  10. {
  11.  
  12.  
  13. DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(_tableName + "_Scope");
  14. //definisikan scope table
  15. DbSyncTableDescription tabDesc = SqlSyncDescriptionBuilder.GetDescriptionForTable(_tableName, con);
  16. //tambahkan table ke scope definisi
  17. scopeDesc.Tables.Add(tabDesc);
  18. switch (type)
  19. {
  20. case "Provisioning":
  21. SqlSyncScopeProvisioning srvProvision = new SqlSyncScopeProvisioning(con, scopeDesc);
  22. srvProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);
  23. //SyncTracer.Verbose("")
  24. srvProvision.Apply();
  25. break;
  26. case "Deprovisioning":
  27. SqlSyncScopeDeprovisioning srvDeProvision = new SqlSyncScopeDeprovisioning(con);
  28. srvDeProvision.DeprovisionScope(_tableName + "_Scope");
  29. srvDeProvision.DeprovisionStore();
  30. break;
  31. }
  32.  
  33.  
  34.  
  35. }
  36. return null;
  37. }
  38. catch (SyncException ex)
  39. {
  40. StringBuilder sb = new StringBuilder();
  41. //sb.Append("n Error Number : " + ex.ErrorNumber.ToString());
  42. sb.Append("n Message : " + ex.Message);
  43. sb.Append("n Stack Trace :" + ex.StackTrace);
  44. return sb.ToString();
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement