SqlSyncDescriptionBuilder-Klasse
Stellt Bereichs- und Tabelleninformationen für eine SQL Server-Datenbank dar, die an der Synchronisierung beteiligt ist.
Namespace: Microsoft.Synchronization.Data.SqlServer
Assembly: Microsoft.Synchronization.Data.SqlServer (in Microsoft.Synchronization.Data.SqlServer.dll)
Syntax
'Declaration
Public NotInheritable Class SqlSyncDescriptionBuilder
'Usage
public static class SqlSyncDescriptionBuilder
public ref class SqlSyncDescriptionBuilder abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type SqlSyncDescriptionBuilder = class end
public final class SqlSyncDescriptionBuilder
Beispiele
Im folgenden Codebeispiel wird ein Bereich mit dem Namen filtered_customer beschrieben, dem zwei Tabellen hinzugefügt werden: Customer und CustomerContact. Die Tabellen sind bereits in der Serverdatenbank vorhanden. Deshalb wird die GetDescriptionForTable-Methode verwendet, um das Schema aus der Serverdatenbank abzurufen. Aus der Customer-Tabelle sind alle Spalten enthalten, aus der CustomerContact-Tabelle jedoch nur zwei Spalten. Eine Darstellung dieses Codes im Kontext eines vollständigen Beispiels finden Sie unter Vorgehensweise: Konfigurieren und Ausführen der Datenbanksynchronisierung (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)
Vererbungshierarchie
System. . :: . .Object
Microsoft.Synchronization.Data.SqlServer..::..SqlSyncDescriptionBuilder
Threadsicherheit
Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.