I am backing up and restoring a SQL Server database using the C # .NET Backup and Restore classes, with Smo. The problem is that after performing the backup of the database with the name, for example "Test", I can not restore the database with another name, which is possible using tools such as Management Studio. Is it possible to restore the database with another name through the class Restore?
public void Restore(String dataBaseName, pathFile)
{
bdi = default(BackupDeviceItem);
bdi = new BackupDeviceItem(pathFile, DeviceType.File);
Restore rs = new Restore();
rs.NoRecovery = false;
rs.SqlVerify(srv);
rs.Devices.Add(bdi);
rs.Database = dataBaseName;
rs.SqlRestore(srv);
rs.Devices.Remove(bdi);
}