Compartilhar via


Método Apply

Aplica o script de provisionamento na conexão especificada no construtor.

Namespace:  Microsoft.Synchronization.Data.SqlServerCe
Assembly:  Microsoft.Synchronization.Data.SqlServerCe (em Microsoft.Synchronization.Data.SqlServerCe.dll)

Sintaxe

'Declaração
Public Sub Apply
'Uso
Dim instance As SqlCeSyncScopeProvisioning

instance.Apply()
public void Apply()
public:
void Apply()
member Apply : unit -> unit 
public function Apply()

Exemplos

O exemplo a seguir mostra como definir um escopo filtrado que inclua somente itens da tabela Sales.Customer que tenham um valor de CustomerType igual a Retail. O escopo filtrado é então usado para provisionar um banco de dados do SQL Azure e um banco de dados cliente do SQL Server Compact para sincronização filtrada.

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()

Consulte também

Referência

SqlCeSyncScopeProvisioning Classe

Membros SqlCeSyncScopeProvisioning

Sobrecarga Apply

Namespace Microsoft.Synchronization.Data.SqlServerCe