Condividi tramite


IDatabaseSnapshotRestore.OnPostRestore Method

Provides post-event processing after a database (SPDatabase object) is restored from one of its snapshots.

Namespace:  Microsoft.SharePoint.Administration.Backup
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Sub OnPostRestore ( _
    args As SPDatabaseSnapshotRestoreEvent _
)
'Usage
Dim instance As IDatabaseSnapshotRestore
Dim args As SPDatabaseSnapshotRestoreEvent

instance.OnPostRestore(args)
void OnPostRestore(
    SPDatabaseSnapshotRestoreEvent args
)

Parameters

Remarks

Implement this method to provide custom logic that executes after a database is restored from a snapshot.

Do not call this method from your own code. The restoration process calls it.

Examples

The following example shows an implementation that might be used for a database. The “this” refers to an object of a custom type called SupplementalDatabase that a developer has derived from SPDatabase and that implements IDatabaseSnapshotRestore. The method sets the database back online.

Note

SPDatabase has another OnPostRestore(Object, SPRestoreInformation) method by virtue of implementing IBackupRestore, but it has a different signature, so there is no name clash.

public void OnPostRestore(SPDatabaseSnapshotRestoreEvent args)
{
    if (args == null)
    {
        throw new ArgumentNullException("args");
    }

    this.Status = SPObjectStatus.Online;
    this.Update(true);
}

See Also

Reference

IDatabaseSnapshotRestore Interface

IDatabaseSnapshotRestore Members

Microsoft.SharePoint.Administration.Backup Namespace