Share via


SqlSyncStoreRestore.PerformPostRestoreFixup Method

Updates synchronization metadata in a SQL Server database after the database has been restored from a backup.

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

Syntax

'Declaration
Public Sub PerformPostRestoreFixup
'Usage
Dim instance As SqlSyncStoreRestore

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

Exceptions

Exception Condition
ArgumentNullException

Connection is a null reference (Nothing in Visual Basic).

DbSyncException

The knowledge for a scope could not be updated.

Remarks

Use this method after you have restored a SQL Server database from a backup. Sync Framework updates synchronization metadata for all scopes that are configured in the database. For more information, see How to: Backup and Restore a Database (SQL Server).

Examples

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

See Also

Reference

SqlSyncStoreRestore Class

Microsoft.Synchronization.Data.SqlServer Namespace