views:

243

answers:

1

Hi,

Our central database is to be synchronized in a hub & spoke fashion.

We need to be able to partition the data in a way that client data is replicated locally only to that client.

Has anyone faced this problem?

MSF provides sync scopes - declarations of tables are to be sycned, with the option to specify a filtercolumn and filter clause, however there doesn't seem to be a way to pass a parameter (say clientID) to the filter.

Here's and example from the msdn documentation:

        ' Create a scope named "filtered_customer", and add two tables to the scope. 
        ' GetDescriptionForTable gets the schema of each table, so that tracking 
        ' tables and triggers can be created for that table. 
        Dim scopeDesc As New DbSyncScopeDescription("filtered_customer")

        scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("Customer", serverConn))
        scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("CustomerContact", serverConn))

        ' Create a provisioning object for "filtered_customer" and specify that 
        ' base tables should not be created (They already exist in SyncSamplesDb_SqlPeer1). 
        Dim serverConfig As New SqlSyncScopeProvisioning(scopeDesc)
        serverConfig.CreateTableDefault = DbSyncCreationOption.Skip

        ' Specify which column(s) in the Customer table to use for filtering data, 
        ' and the filtering clause to use against the tracking table. 
        ' "[side]" is an alias for the tracking table. 
        serverConfig("Customer").AddFilterColumn("CustomerType")
        serverConfig("Customer").FilterClause = "[side].[CustomerType] = 'Retail'"

        ' Configure the scope and change tracking infrastructure. 
        serverConfig.Apply(serverConn)

Our problem is that we need to the filter to except a clientID as a runtime parameter.

Is this supported in the MSF?

If not perhaps this can this be achieved by declaring multiple scopes - declare a scope per client with the filterclause specifying the clientID. This would require the server to be re-provisioned every time we create a new client.... right?

Does anyone know if the SqlSyncScopeProvisioning class can be used to add a new scope to a database that has already been provisioned with an existing scope?

Seemingly the MSF has been designed to support multiple scopes, it's not clear to me how the SqlSyncScopeProvisioning class is used to add additional scopes.

thank you,

Ashley

A: 

Have you found a solution for this? I have almost the same scenario, in my case I would like the client app, when it's live, to choose which client to have when in offline mode.

David Martins