Hi
I've followed the instructions here http://jtabadero.wordpress.com/2010/09/02/sync-framework-provisioning/ to create a scope template and a parameter based scope that uses the template but my sync session still synchronises all rows. I suspect that
it's due to the direction I'm syncing but that's just a guess.
Here's my setup in broad strokes. There will be several local apps pushing up orders to the remote app, the remote app simply approve or rejects orders. I want the local app to sync new orders up and only updates to it's own orders or approved orders
from other clients back down.
I've got two peers, my LocalProvider is a SqlSyncProvider connected to a LocalDB instance, the RemoteProvider is a proxy via WCF services to another LocalDB instance.
I've created a broad scope for TableA called SyncTableA (I did this before I started working on a filtered scope).
I've got a template scope for TableA called SyncTableA_Filtered. My template is defined as follows..
SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning(connection, scopeDesc, SqlSyncScopeProvisioningType.Template);
serverTemplate.Tables["TableA"].AddFilterColumn("ClientId");
serverTemplate.Tables["TableA"].AddFilterColumn("Status");
serverTemplate.Tables["TableA"].FilterClause = "[side].[ClientId] = @clientId or [side].[Status] = 2";
SqlParameter param = new SqlParameter("@clientId", SqlDbType.UniqueIdentifier);
serverTemplate.Tables["TableA"].FilterParameters.Add(param);
serverTemplate.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
serverTemplate.Apply();
I've directly created this template scope on my local database and my remote database. (not via a proxy, I executed this with two different connections passed to the SqlSyncScopeProvisioning constructor.
Then I've created a scope from the template called SyncTableA_Filtered-Me, and applied it to the local database.
Then I get the scope from the local database and create it on the remote database.
DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("SyncTableA_Filtered-Me", sqlConnection);
remote.CreateScopeDescription(scopeDesc);
I insert a few records locally, sync them up to the server, fake insert some records from other clients on the server, approve a few of them and synchronise again. Every fake record from the other client is downloaded, the filter doesn't work.