0
votes

I am trying to provision a few scopes on the same table to synchronize different sets of the data within the table. The provisioning works great with no errors. When I go to synchronize, however, the call to SyncOrchestrator.Synchronize() times out.

When I sync just one of the scopes, it appears that all of the data is being synchronized, not just the data being defined by the scope filter.

Here is my provisioning code for a one of the scopes. The scopes are each run in a separate thread so that they are synchronized concurrently.

Server Provisioning:

var remoteLogVariableScopeDescription = new DbSyncScopeDescription(string.Format("{0}_{1}", DatabaseID, scopeName));
remoteLogVariableScopeDescription.Tables.Add(SqlCeSyncDescriptionBuilder.GetDescriptionForTable("TableName", localConnection));
var remoteDatabaseConfiguration = new SqlSyncScopeProvisioning(remoteConnection, remoteLogVariableScopeDescription);
remoteDatabaseConfiguration.ObjectPrefix = string.Format("Sync_{0}", scopeName);
remoteDatabaseConfiguration.Tables["TableName"].AddFilterColumn("Time);
remoteDatabaseConfiguration.Tables["TableName"].FilterClause = [side].Time >= DATEADD(minute, -1, GETDATE());
remoteDatabaseConfiguration.SetCreateTableDefault(DbSyncCreationOption.Skip);
remoteDatabaseConfiguration.SetUseBulkProceduresDefault(true);
remoteDatabaseConfiguration.CommandTimeout = 30;
remoteDatabaseConfiguration.Apply()

Local Provisioning:

DbSyncScopeDescription localFrequentScopeDescription = SqlSyncDescriptionBuilder.GetDescriptionForScope(string.Format("{0}_{1}", DatabaseID, scopeName), string.Format("Sync_{0}", scopeName), remoteConnection);
var localDatabaseConfiguration = new SqlCeSyncScopeProvisioning(localConnection, localFrequentScopeDescription);
localDatabaseConfiguration.ObjectPrefix = string.Format("Sync_{0}", scopeName);
localDatabaseConfiguration.SetCreateTableDefault(DbSyncCreationOption.Skip);
localDatabaseConfiguration.Apply();

My questions are: Is the scope filter I provided possible? Can you run multiple scopes on the same table concurrently?

Thanks in advance for any help!

2

2 Answers

1
votes

Filters are not supported on SQL Sever Compact Edition. Any changes that you make there will be synced back to the server.

1
votes

as Scott mentioned, the SqlCeSyncProvider doesnt support filtering.

likewise, even if you change the client to SQL Express/Server, GetDescriptionForScope does not include the filter configuration when returning the scope configuration.

also, you can define multiple against the same scope, however beware of overlapping scopes where rows may belong to multiple scopes. that may result to sync loops.

e.g. (assuming bidirectional sync)

scope 1 filter includes row 1

scope 2 filter also includes row 1

you update row 1 on server

scope 1 syncs and applies row 1 to your client

scope 2 syncs and detects the row 1 downloaded and applied by scope 1 (scope 2 has no idea of scope1)

so scope 2 uploads and applies row 1 to server (the same row change in server returned to the server)

scope 1 syncs and picks up row 1 from server again and so on...