'Declaration Public Overloads Function BeginRestore( _ ByVal fileName As String _ ) As IAsyncResult
public IAsyncResult BeginRestore( string fileName )
Parameters
- fileName
- The name of the file to load the script from.
'Declaration Public Overloads Function BeginRestore( _ ByVal fileName As String _ ) As IAsyncResult
public IAsyncResult BeginRestore( string fileName )
BeginRestore(String) method enables you to perform a restore operation without having current thread blocked. In other words, your program can continue execution while the restore operation runs in background so you do not have to wait for it.
To start the restore operation, you have to call BeginRestore(String) method, which in turn invokes appropriate actions in another thread. Return value of this method must be assigned to an System.IAsyncResult object. After executing this method, the program flow continues.
When you are ready to finish the backup operation, call EndRestore. If at the moment you call this function the restore operation has not yet been finished, application stops and waits till the function returns.
public void DumpIt(SQLiteConnection conn) { conn.Open(); SQLiteDump sqSqlDump = new SQLiteDump(); sqSqlDump.Connection = conn; sqSqlDump.IncludeDrop = true; IAsyncResult Result = sqSqlDump.BeginBackup("d:\\dump.dmp"); while (!Result.IsCompleted) { Console.Write("."); //Perform here any operation you need } sqSqlDump.EndBackup(Result); Console.WriteLine("Dumped."); conn.Close(); } public void UnDumpIt(SQLiteConnection conn) { conn.Open(); SQLiteDump sqSqlDump = new SQLiteDump(); sqSqlDump.Connection = conn; IAsyncResult Result = sqSqlDump.BeginRestore("d:\\dump.dmp"); while (!Result.IsCompleted) { Console.Write("."); //Perform here any operation you need } sqSqlDump.EndRestore(Result); Console.WriteLine("Restored."); conn.Close(); }
Public Sub DumpIt(conn As SQLiteConnection) conn.Open() Dim sqSqlDump As New SQLiteDump() sqSqlDump.Connection = conn sqSqlDump.IncludeDrop = True Dim Result As IAsyncResult = sqSqlDump.BeginBackup("d:\dump.dmp") While Not Result.IsCompleted 'Perform here any operation you need Console.Write(".") End While sqSqlDump.EndBackup(Result) Console.WriteLine("Dumped.") conn.Close() End Sub Public Sub UnDumpIt(conn As SQLiteConnection) conn.Open() Dim sqSqlDump As New SQLiteDump() sqSqlDump.Connection = conn Dim Result As IAsyncResult = sqSqlDump.BeginRestore("d:\dump.dmp") While Not Result.IsCompleted 'Perform here any operation you need Console.Write(".") End While sqSqlDump.EndRestore(Result) Console.WriteLine("Restored.") conn.Close() End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2