I've a N-tier Sync Framework application that has a WCF Service hosted on Azure and clients running a small WPF client. These clients sync their local SQL Server Express database with a SQL Database on Azure using the WCF Service. So from the WPF app the SyncOrchestrator uses a SqlSyncProvider (LocalProvider) and a RelationalProviderProxy (RemoteProvider) via a Proxy. Provisioning is done manually on server using the SyncSvcUtilUI from Microsoft and is applied on clients at runtime. It works like a charm!
But now I need to add filters. So clients can choose what Customers they want to sync. They have a simple drop-down to choose client's location (let's say only clients from NY) and then I would apply these filters and Sync. So that's what I'm doing right now:
- I've changed the provisioning for the server. I've manually created a scope template using some dynamic filters. For example, Customers table has a side.location = @location filter clause. This is provisioned manually.
- When the client choose filters and hit 'Sync', it gets the scope template from the server, applies filter values and creates a new scope.
- Then it executes a deprovision of the server and itself (client) BEFORE applying the new scope.
- Finally, client applies this new scope that has filter values on both server and client.
- Then it syncs.
- This process happens for each sync request!
The problem? I've to execute a deprovision of both client and server EACH TIME before syncing, losing tracking and sending all the data again and again. And that's my problem. I can't believe that there is no other way around. Or am I missing something? I need to work with filters and they need to be dynamic.
Please, if anyone has some tips about a better way to do it, I would really appreciate (I'm all ears) :)
Thanks!!