Share via


SqlCeSyncScopeProvisioning.Apply Method ()

Note: This API is now obsolete.

Applies the provisioning script to a SQL Server Compact database over the specified connection.

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

Syntax

'Declaration
<ObsoleteAttribute("Use Connection property and Apply()")> _
Public Sub Apply ( _
    connection As SqlCeConnection _
)
'Usage
Dim instance As SqlCeSyncScopeProvisioning
Dim connection As SqlCeConnection

instance.Apply(connection)
[ObsoleteAttribute("Use Connection property and Apply()")]
public void Apply(
    SqlCeConnection connection
)
[ObsoleteAttribute(L"Use Connection property and Apply()")]
public:
void Apply(
    SqlCeConnection^ connection
)
[<ObsoleteAttribute("Use Connection property and Apply()")>]
member Apply : 
        connection:SqlCeConnection -> unit 
public function Apply(
    connection : SqlCeConnection
)

Parameters

  • connection
    Type: SqlCeConnection
    A SqlCeConnection object that contains a connection to the database.

Exceptions

Exception Condition
ArgumentNullException

connection is null reference (Nothing in Visual Basic).

DbSyncException

A transaction is already in progress.

Examples

The following code example provisions a SQL Server Compact database. Provisioning is based on scope information that is retrieved from the server by calling GetDescriptionForScope and specifying the scope name ("filtered_customer"), the connection, the object prefix name used on the server (null), and the optional database schema in which Sync Framework stores synchronization objects (in this case "Sync"). SQL Server Compact databases do not support separate schemas, so we prefix the name of all synchronization-related objects with "Sync" so that they are easy to identify. To view this code in the context of a complete example, see How To: Execute Database Synchronization (SQL Server).

DbSyncScopeDescription clientSqlCe1Desc = SqlSyncDescriptionBuilder.GetDescriptionForScope("filtered_customer", null, "Sync", serverConn);
SqlCeSyncScopeProvisioning clientSqlCe1Config = new SqlCeSyncScopeProvisioning(clientSqlCe1Conn, clientSqlCe1Desc);
clientSqlCe1Config.ObjectPrefix = "Sync";
clientSqlCe1Config.Apply();
Dim clientSqlCe1Desc As DbSyncScopeDescription = _
    SqlSyncDescriptionBuilder.GetDescriptionForScope("filtered_customer", Nothing, "Sync", serverConn)
Dim clientSqlCe1Config As New SqlCeSyncScopeProvisioning(clientSqlCe1Conn, clientSqlCe1Desc)
clientSqlCe1Config.ObjectPrefix = "Sync"
clientSqlCe1Config.Apply()

See Also

Reference

SqlCeSyncScopeProvisioning Class

Apply Overload

Microsoft.Synchronization.Data.SqlServerCe Namespace