SqlSyncStoreRestore 类

表示在 SQL Server 数据库从备份还原之后必须执行的操作。

命名空间:  Microsoft.Synchronization.Data.SqlServer
程序集:  Microsoft.Synchronization.Data.SqlServer(在 Microsoft.Synchronization.Data.SqlServer.dll 中)

语法

声明
Public Class SqlSyncStoreRestore
用法
Dim instance As SqlSyncStoreRestore
public class SqlSyncStoreRestore
public ref class SqlSyncStoreRestore
type SqlSyncStoreRestore =  class end
public class SqlSyncStoreRestore

注释

还原同步所涉及的 SQL Server 数据库之后使用此类。有关更多信息,请参见如何备份和还原数据库 (SQL Server)

示例

下面的代码示例通过调用 Utility 示例方法之一还原服务器数据库,然后调用 PerformPostRestoreFixup 以更新元数据。若要在完整应用程序上下文中查看此代码,请参见如何备份和还原数据库 (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()

继承层次结构

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

线程安全

此类型的所有公共成员static(在 Visual Basic 中为 Shared) 都是线程安全的。不保证所有实例成员都是线程安全的。

请参阅

参考

SqlSyncStoreRestore 成员

Microsoft.Synchronization.Data.SqlServer 命名空间