#region Method: RestoreDatabaseBackup
///
/// Restores a DataBase backup
///
///
/// The Database restore operation will be done using a stored procedure called
/// dnx_unittest_restoredatabasebackup
/// That should have as code:
///
/// use Master
/// RESTORE DATABASE Northwind
/// FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\NorthwindBk'
///
///
public virtual void RestoreDatabaseBackup(string database, string backupFilePath)
{
//Dnx.DnxDataLayer.DbBase dbBase = new Dnx.DnxDataLayer.DbBase(this.AuthenticationContext);
this.AuthenticationContext.TransactionManager.OpenConnection();
IDbCommand cmd = this.AuthenticationContext.TransactionManager.Connection.CreateCommand();
try
{
cmd.CommandTimeout = 180;
cmd.CommandText =
string.Format(@"USE MASTER;RESTORE DATABASE {0} FROM DISK = '{1}';", database, backupFilePath);
cmd.ExecuteNonQuery();
}
finally
{
this.AuthenticationContext.TransactionManager.CloseConnection();
}
}
#endregion
Tuesday, February 22, 2005
NUnit: Restores a DataBase backup
at 5:42 PM Posted by roni schuetz
Subscribe to:
Post Comments (Atom)
Shared Cache - .Net Caching made easy
All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.
No comments:
Post a Comment