SqlSyncDescriptionBuilder 类

表示同步中涉及的 SQL Server 数据库的作用域和表信息。

命名空间: Microsoft.Synchronization.Data.SqlServer
程序集: Microsoft.Synchronization.Data.SqlServer(在 microsoft.synchronization.data.sqlserver.dll 中)

语法

声明
Public NotInheritable Class SqlSyncDescriptionBuilder
用法
The members of a static class are accessed directly without an instance of the class.
public static class SqlSyncDescriptionBuilder
public ref class SqlSyncDescriptionBuilder abstract sealed
public final class SqlSyncDescriptionBuilder
public final class SqlSyncDescriptionBuilder

示例

下面的代码示例描述名为 filtered_customer 的一个作用域,并且将两个表添加到该作用域:CustomerCustomerContact。这两个表已存在于服务器数据库中,因此,使用 GetDescriptionForTable 方法从服务器数据库中检索架构。将包括来自 Customer 表的所有列,但只包括来自 CustomerContact 表的两列。若要在完整示例上下文中查看此代码,请参见如何配置和执行协作同步 (SQL Server)

DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("filtered_customer");

// Definition for Customer.
DbSyncTableDescription customerDescription =
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn);

scopeDesc.Tables.Add(customerDescription);

// Definition for CustomerContact, including the list of columns to include.
Collection<string> columnsToInclude = new Collection<string>();
columnsToInclude.Add("CustomerId");
columnsToInclude.Add("PhoneType");
DbSyncTableDescription customerContactDescription =
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn);

scopeDesc.Tables.Add(customerContactDescription);
Dim scopeDesc As New DbSyncScopeDescription("filtered_customer")

' Definition for Customer. 
Dim customerDescription As DbSyncTableDescription = _
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn)

scopeDesc.Tables.Add(customerDescription)


' Definition for CustomerContact, including the list of columns to include. 
Dim columnsToInclude As New Collection(Of String)()
columnsToInclude.Add("CustomerId")
columnsToInclude.Add("PhoneType")
Dim customerContactDescription As DbSyncTableDescription = _
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn)

scopeDesc.Tables.Add(customerContactDescription)

继承层次结构

System.Object
  Microsoft.Synchronization.Data.SqlServer.SqlSyncDescriptionBuilder

线程安全

此类型的所有公共静态(在 Visual Basic 中共享 )成员都是线程安全的。不保证任何实例成员的线程安全。

请参阅

参考

SqlSyncDescriptionBuilder 成员
Microsoft.Synchronization.Data.SqlServer 命名空间