SqlSyncScopeProvisioning クラス
DbSyncScopeDescription オブジェクトによって表される特定のスコープに対応する SQL Server データベースの準備を表します。
名前空間: Microsoft.Synchronization.Data.SqlServer
アセンブリ: Microsoft.Synchronization.Data.SqlServer (Microsoft.Synchronization.Data.SqlServer.dll 内)
構文
'宣言
Public Class SqlSyncScopeProvisioning
'使用
Dim instance As SqlSyncScopeProvisioning
public class SqlSyncScopeProvisioning
public ref class SqlSyncScopeProvisioning
type SqlSyncScopeProvisioning = class end
public class SqlSyncScopeProvisioning
例
次のコード例は、filtered_customer スコープ用に準備オブジェクトを作成し、ベース テーブルがサーバー データベースに作成されないように指定します。さらに、同期に関連するオブジェクトはすべて "Sync" という名前のデータベース スキーマ内で作成されるように指定します。スコープを準備する処理の一環として、Customer テーブルに対するフィルターを定義します。このフィルターに一致した行だけが同期されます。CustomerContact テーブルにはフィルターを定義しません。したがって、このテーブルのすべての行が同期されます。準備オプションを定義した後、Apply メソッドを呼び出して、サーバー データベースに変更追跡インフラストラクチャを作成します。さらに、準備スクリプトをファイルに書き込みます。完全なコンテキスト例でこのコードを表示するには、「方法: データベース同期を構成して実行する (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())
継承階層
System. . :: . .Object
Microsoft.Synchronization.Data.SqlServer..::..SqlSyncScopeProvisioning
スレッド セーフ
この型の public static (Visual Basic では Shared) のメンバーはスレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。