Share via


SqlSyncScopeProvisioning-Klasse

Stellt die Bereitstellung einer SQL Server-Datenbank für einen bestimmten Bereich dar, der durch ein DbSyncScopeDescription-Objekt dargestellt wird.

Namespace:  Microsoft.Synchronization.Data.SqlServer
Assembly:  Microsoft.Synchronization.Data.SqlServer (in Microsoft.Synchronization.Data.SqlServer.dll)

Syntax

'Declaration
Public Class SqlSyncScopeProvisioning
'Usage
Dim instance As SqlSyncScopeProvisioning
public class SqlSyncScopeProvisioning
public ref class SqlSyncScopeProvisioning
type SqlSyncScopeProvisioning =  class end
public class SqlSyncScopeProvisioning

Beispiele

Im folgenden Codebeispiel wird ein Bereitstellungsobjekt für den filtered_customer-Bereich erstellt, es wird angegeben, dass die Basistabellen nicht in der Serverdatenbank erstellt werden sollen und dass synchronisierungsbezogene Objekte in einem Datenbankschema mit dem Namen "Sync" erstellt werden sollen. Als Teil der Bereitstellung des Bereichs wird mit dem Code ein Filter für die Customer-Tabelle definiert. Nur Zeilen, die mit dem Filter übereinstimmen, werden synchronisiert. Für die CustomerContact-Tabelle wird kein Filter definiert. Dadurch werden alle Zeilen aus dieser Tabelle synchronisiert. Nachdem die Bereitstellungsoptionen definiert wurden, wird die Apply-Methode aufgerufen, um die Infrastruktur für die Änderungsnachverfolgung in der Serverdatenbank zu erstellen, und das Bereitstellungsskript wird in eine Datei geschrieben. Eine Darstellung dieses Codes im Kontext eines vollständigen Beispiels finden Sie unter Vorgehensweise: Konfigurieren und Ausführen der Datenbanksynchronisierung (SQL Server).

SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(serverConn, scopeDesc);
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
serverConfig.ObjectSchema = "Sync";

// 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.Tables["Sales.Customer"].AddFilterColumn("CustomerType");
serverConfig.Tables["Sales.Customer"].FilterClause = "[side].[CustomerType] = 'Retail'";

// Configure the scope and change-tracking infrastructure.
serverConfig.Apply();

// Write the configuration script to a file. You can modify 
// this script if necessary and run it against the server
// to customize behavior.
File.WriteAllText("SampleConfigScript.txt",
    serverConfig.Script());
Dim serverConfig As New SqlSyncScopeProvisioning(serverConn, scopeDesc)
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip)
serverConfig.ObjectSchema = "Sync"

' 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.Tables("Sales.Customer").AddFilterColumn("CustomerType")
serverConfig.Tables("Sales.Customer").FilterClause = "[side].[CustomerType] = 'Retail'"

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

' Write the configuration script to a file. You can modify 
' this script if necessary and run it against the server 
' to customize behavior. 
File.WriteAllText("SampleConfigScript.txt", serverConfig.Script())

Vererbungshierarchie

System. . :: . .Object
  Microsoft.Synchronization.Data.SqlServer..::..SqlSyncScopeProvisioning

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Siehe auch

Verweis

SqlSyncScopeProvisioning-Member

Microsoft.Synchronization.Data.SqlServer-Namespace