SqlSyncStoreRestore Class

Represents operations that must occur after a SQL Server database is restored from a backup.

System.Object
  Microsoft.Synchronization.Data.SqlServer.SqlSyncStoreRestore

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

'Declaration
Public Class SqlSyncStoreRestore
'Usage
Dim instance As SqlSyncStoreRestore

The SqlSyncStoreRestore type exposes the following members.

  NameDescription
Public methodSqlSyncStoreRestore(SqlConnection)Initializes a new instance of the SqlSyncStoreRestore class with the specified connection.
Public methodSqlSyncStoreRestore(SqlConnection, String)Initializes a new instance of the SqlSyncStoreRestore class with the specified connection and object prefix.
Public methodSqlSyncStoreRestore(SqlConnection, String, String)Initializes a new instance of the SqlSyncStoreRestore class with the specified connection, object prefix, and object schema.
Top

  NameDescription
Public propertyCommandTimeoutGets or sets the wait time, in seconds, before a restore command is stopped and an error is generated.
Public propertyConnectionGets or sets a SqlConnection object that contains a connection to the database.
Public propertyObjectPrefixGets or sets the optional prefix that is used to identify objects that Sync Framework creates.
Public propertyObjectSchemaGets or sets the database schema in which Sync Framework creates objects.
Top

  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodPerformPostRestoreFixupUpdates synchronization metadata in a SQL Server database after the database has been restored from a backup.
Public methodToString (Inherited from Object.)
Top

Use this class after you have restored a SQL Server database that is involved in synchronization. For more information, see How to: Backup and Restore a Database (SQL Server).

The following code example restores a server database by calling one of the sample Utility methods, and then calls PerformPostRestoreFixup to update metadata. To view this code in the context of a complete application, see How to: Backup and Restore a Database (SQL Server).

Utility.RestoreDatabaseFromBackup();


// Call the API to update synchronization metadata to reflect that the database was
// just restored. The restore stored procedure kills the connection to the
// server, so we must re-establish it.
SqlConnection.ClearPool(serverConn);
serverConn = new SqlConnection(Utility.ConnStr_SqlSync_Server);
SqlSyncStoreRestore databaseRestore = new SqlSyncStoreRestore(serverConn);
databaseRestore.PerformPostRestoreFixup();


Utility.RestoreDatabaseFromBackup()


' Call the API to update synchronization metadata to reflect that the database was 
' just restored. The restore stored procedure kills the connection to the 
' server, so we must re-establish it. 
SqlConnection.ClearPool(serverConn)
serverConn = New SqlConnection(Utility.ConnStr_SqlSync_Server)
Dim databaseRestore As New SqlSyncStoreRestore(serverConn)
databaseRestore.PerformPostRestoreFixup()


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: