SqlSyncStoreRestore::PerformPostRestoreFixup Method
Updates synchronization metadata in a SQL Server database after the database has been restored from a backup.
Assembly: Microsoft.Synchronization.Data.SqlServer (in Microsoft.Synchronization.Data.SqlServer.dll)
| Exception | Condition |
|---|---|
| ArgumentNullException | Connection is a nullptr. |
| DbSyncException | The knowledge for a scope could not be updated. |
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).
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()
Show: