Add a collection of items as a Scope filter RRS feed

  • Question

  • My requirement is to sync a local SQL CE client with a SQL server. I have a table which has to be selectively synchronized(on multiple row values called CustomerIds) with the local DB(sqlce) 

    Here is what i  have currently :

    1. Create a local SQLCe db for each CustomerID and ,
    2. Create a template filter in the server on CustomerID and create scopes when required depending on the client to sync with.
    3. As i have a dynamically changing collection of CustomerIds to sync with the server, I sychronize multiple times with the server in a For loop with the CustomerId as a filter parameter(also creating new scopes).

    The looping through multiple values is killing the performance. Is there a way to send a collection of values as a Scope filter parameter and do it dynamically? If so how do i configure the scopes for the client and the server?

    Thanks in advance.



    Thursday, July 28, 2011 4:30 PM

All replies

  • can you expound on the dynamic part? how often does it change? does the user change it?
    Thursday, July 28, 2011 11:14 PM
  • The List of CustomerIds to be synced depends on another independent query, so it does change pretty often. 



    Friday, July 29, 2011 5:29 AM
  • you can do an IN clause in your FilterClause, e.g., CustomerId IN (Select CustomerId from CustomerIdsTable where ClientId = @ClientId)

    however, please note that Sync Framework doesnt support "partition re-alignment" or rows going "in-scope" and "out-of-scope".

    Assuming your client initially has customer Ids 1 and 2. The you change the filter so that the customer Id list is now 1 and 3. The previously downloaded data for customer Id 2 will not be removed from your client (these rows just went out of scope). Likewise, unless the rows for customer Id 3 has been updated since the last synch, they will not be downloaded by your client (these are rows are going in-scope).

    Tuesday, August 2, 2011 1:17 AM