SqlSyncScopeProvisioning.SetCreateTableDefault メソッド
スコープを構成するときにベース テーブルを作成するかどうかを設定します。
名前空間: Microsoft.Synchronization.Data.SqlServer
アセンブリ: Microsoft.Synchronization.Data.SqlServer (microsoft.synchronization.data.sqlserver.dll 内)
構文
'宣言
Public Sub SetCreateTableDefault ( _
defaultOption As DbSyncCreationOption _
)
'使用
Dim instance As SqlSyncScopeProvisioning
Dim defaultOption As DbSyncCreationOption
instance.SetCreateTableDefault(defaultOption)
public void SetCreateTableDefault (
DbSyncCreationOption defaultOption
)
public:
void SetCreateTableDefault (
DbSyncCreationOption defaultOption
)
public void SetCreateTableDefault (
DbSyncCreationOption defaultOption
)
public function SetCreateTableDefault (
defaultOption : DbSyncCreationOption
)
パラメーター
- defaultOption
ベース テーブルを作成するかどうかを指定する DbSyncCreationOption 列挙値。
解説
ベース テーブルがデータベース内に既に存在しており、DbSyncTableDescription オブジェクトを使用してテーブル スキーマを定義しない場合は、Skip という値を指定します。
例
次のコード例は、filtered_customer
スコープ用に準備オブジェクトを作成し、ベース テーブルがサーバー データベースに作成されないように指定します。さらに、同期に関連するオブジェクトはすべて "Sync"
という名前のデータベース スキーマ内で作成されるように指定します。スコープを準備する処理の一環として、Customer
テーブルに対するフィルターを定義します。このフィルターに一致した行だけが同期されます。CustomerContact
テーブルにはフィルターを定義しません。したがって、このテーブルのすべての行が同期されます。準備オプションを定義した後、Apply メソッドを呼び出して、サーバー データベースに変更追跡インフラストラクチャを作成します。さらに、準備スクリプトをファイルに書き込みます。完全なコンテキスト例でこのコードを表示するには、「コラボレーション同期を構成して実行する方法 (SQL Server)」を参照してください。
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(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(serverConn);
// 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("SyncSamplesDb_SqlPeer1"));
Dim serverConfig As New SqlSyncScopeProvisioning(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(serverConn)
' 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("SyncSamplesDb_SqlPeer1"))
参照
リファレンス
SqlSyncScopeProvisioning クラス
SqlSyncScopeProvisioning メンバー
Microsoft.Synchronization.Data.SqlServer 名前空間