SqlSyncDescriptionBuilder 类
表示同步中涉及的 SQL Server 数据库的作用域和表信息。
命名空间: Microsoft.Synchronization.Data.SqlServer
程序集: Microsoft.Synchronization.Data.SqlServer(在 Microsoft.Synchronization.Data.SqlServer.dll 中)
语法
声明
Public NotInheritable Class SqlSyncDescriptionBuilder
用法
public static class SqlSyncDescriptionBuilder
public ref class SqlSyncDescriptionBuilder abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type SqlSyncDescriptionBuilder = class end
public final class SqlSyncDescriptionBuilder
示例
下面的代码示例描述名为 filtered_customer 的一个作用域,并且将两个表添加到该作用域:Customer 和 CustomerContact。这两个表已存在于服务器数据库中,因此,使用 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
线程安全
此类型的所有公共成员static(在 Visual Basic 中为 Shared) 都是线程安全的。不保证所有实例成员都是线程安全的。