代码之家  ›  专栏  ›  技术社区  ›  chickeninabiscuit

如何使用Microsoft同步框架(v2 CTP 2)对客户端敏感数据进行分区?

  •  3
  • chickeninabiscuit  · 技术社区  · 16 年前

    我们的中央数据库将以集线器和辐条的方式同步。

    我们需要能够对数据进行分区,使客户机数据只在本地复制到该客户机。

    有人面对过这个问题吗?

    MSF提供同步作用域-表的声明将被同步,可以选择指定filtercolumn和filter子句,但是似乎没有方法将参数(比如clientID)传递给筛选器。

    以下是msdn文档中的示例:

            ' 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)
    

    我们的问题是,我们需要过滤器将clientID作为运行时参数排除在外。

    无国界医生支持这个吗?

    是否有人知道,Sql SycCopeSeCuffices类是否可以用于将新的范围添加到已经使用现有范围提供的数据库中?

    似乎MSF被设计为支持多个作用域,但我不清楚如何使用SqlSyncScopeProvisioning类添加其他作用域。

    0 回复  |  直到 15 年前