Quick Note: How To Filter Which Tables You Sync

by wforney 21. October 2010 02:37

I’m messing with sync framework and am just posting this as a quick note to self, but it might help others too. When syncing with a custom scope I’m using this code to filter on a column.

   1:  var sqlAzureProvisioning = new SqlSyncScopeProvisioning(sqlAzureConnection, scope);
   2:  if (!sqlAzureProvisioning.ScopeExists(FilteredScopeName))
   3:  {
   4:      sqlAzureProvisioning.SetCreateTableDefault(DbSyncCreationOption.CreateOrUseExisting);
   5:      sqlAzureProvisioning.SetCreateTrackingTableDefault(DbSyncCreationOption.CreateOrUseExisting);
   6:      sqlAzureProvisioning.SetCreateTriggersDefault(DbSyncCreationOption.CreateOrUseExisting);
   7:      sqlAzureProvisioning.SetCreateProceduresDefault(DbSyncCreationOption.CreateOrUseExisting);
   8:      sqlAzureProvisioning.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.CreateOrUseExisting);
   9:      sqlAzureProvisioning.ObjectSchema = "Sync";
  10:   
  11:      sqlAzureProvisioning.Tables["Contacts"].AddFilterColumn("OwnerContactId");
  12:      sqlAzureProvisioning.Tables["Contacts"].FilterClause =
  13:          string.Format("[side].[OwnerContactId] = '{0}'", Properties.Settings.Default.UserContactId);
  14:   
  15:      sqlAzureProvisioning.Apply();
  16:  }

Technorati Tags: ,

Tags: ,

Software Development | Technology | SQL Azure | Sync Framework

Calendar

<<  August 2014  >>
MonTueWedThuFriSatSun
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Month List

Page List

Email Subscription


RecentComments

Comment RSS

VSAchievements

( Points)