Apply 方法
透過建構函式中所指定的連接,套用佈建指令碼。
命名空間: Microsoft.Synchronization.Data.SqlServerCe
組件: Microsoft.Synchronization.Data.SqlServerCe (在 Microsoft.Synchronization.Data.SqlServerCe.dll 中)
語法
'宣告
Public Sub Apply
'用途
Dim instance As SqlCeSyncScopeProvisioning
instance.Apply()
public void Apply()
public:
void Apply()
member Apply : unit -> unit
public function Apply()
範例
下列範例示範如何定義篩選範圍,該範圍只包含 CustomerType 值為 Retail 之 Sales.Customer 資料表中的項目。然後篩選範圍可用來佈建 SQL Azure 資料庫及 SQL Server Compact 用戶端資料庫,以執行篩選的同步處理。
SqlSyncScopeProvisioning azureRetailCustomersScope = new SqlSyncScopeProvisioning(azureConn);
azureRetailCustomersScope.PopulateFromTemplate("RetailCustomers", "customertype_template");
azureRetailCustomersScope.Tables["Sales.Customer"].FilterParameters["@customertype"].Value = "Retail";
azureRetailCustomersScope.UserDescription = "Customer data includes only retail customers.";
azureRetailCustomersScope.Apply();
// Create a SQL Server Compact database and provision it based on the retail customer scope
// retrieved from the SQL Azure database.
SqlCeConnection clientSqlCeConn = new SqlCeConnection(Utility.ConnStr_SqlCeSync1);
Utility.DeleteAndRecreateCompactDatabase(Utility.ConnStr_SqlCeSync1, true);
DbSyncScopeDescription azureRetailCustomersDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("RetailCustomers", azureConn);
SqlCeSyncScopeProvisioning clientSqlCeConfig = new SqlCeSyncScopeProvisioning(clientSqlCeConn, azureRetailCustomersDesc);
clientSqlCeConfig.Apply();
Dim azureRetailCustomersScope As New SqlSyncScopeProvisioning(azureConn)
azureRetailCustomersScope.PopulateFromTemplate("RetailCustomers", "customertype_template")
azureRetailCustomersScope.Tables("Sales.Customer").FilterParameters("@customertype").Value = "Retail"
azureRetailCustomersScope.UserDescription = "Customer data includes only retail customers."
azureRetailCustomersScope.Apply()
' Create a SQL Server Compact database and provision it based on the retail customer scope
' retrieved from the SQL Azure database.
Dim clientSqlCeConn As New SqlCeConnection(Utility.ConnStr_SqlCeSync1)
Utility.DeleteAndRecreateCompactDatabase(Utility.ConnStr_SqlCeSync1, True)
Dim azureRetailCustomersDesc As DbSyncScopeDescription = SqlSyncDescriptionBuilder.GetDescriptionForScope("RetailCustomers", azureConn)
Dim clientSqlCeConfig As New SqlCeSyncScopeProvisioning(clientSqlCeConn, azureRetailCustomersDesc)
clientSqlCeConfig.Apply()