PerformPostRestoreFixup 方法
命名空间: Microsoft.Synchronization.Data.SqlServer
程序集: Microsoft.Synchronization.Data.SqlServer(在 Microsoft.Synchronization.Data.SqlServer.dll 中)
语法
声明
Public Sub PerformPostRestoreFixup
用法
Dim instance As SqlSyncStoreRestore
instance.PerformPostRestoreFixup()
public void PerformPostRestoreFixup()
public:
void PerformPostRestoreFixup()
member PerformPostRestoreFixup : unit -> unit
public function PerformPostRestoreFixup()
异常
异常 | 条件 |
---|---|
ArgumentNullException | Connection 为 null Nothing nullptr unit null 引用(在 Visual Basic 中为 Nothing) 。 |
DbSyncException | 无法更新作用域的知识。 |
注释
在 SQL Server 数据库从备份还原之后使用此方法。Sync Framework 会为该数据库中配置的所有作用域更新同步元数据。有关更多信息,请参见如何备份和还原数据库 (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()