/// <summary>
        /// Handles a backup request
        /// </summary>
        internal async Task HandleBackupRequest(
            BackupParams backupParams,
            RequestContext <BackupResponse> requestContext)
        {
            try
            {
                BackupResponse response = new BackupResponse();
                ConnectionInfo connInfo;
                bool           supported = IsBackupRestoreOperationSupported(backupParams.OwnerUri, out connInfo);

                if (supported && connInfo != null)
                {
                    DatabaseTaskHelper helper  = AdminService.CreateDatabaseTaskHelper(connInfo, databaseExists: true);
                    SqlConnection      sqlConn = ConnectionService.OpenSqlConnection(connInfo, "Backup");
                    // Connection gets discounnected when backup is done

                    BackupOperation backupOperation = CreateBackupOperation(helper.DataContainer, sqlConn, backupParams.BackupInfo);
                    SqlTask         sqlTask         = null;

                    // create task metadata
                    TaskMetadata metadata = TaskMetadata.Create(backupParams, SR.BackupTaskName, backupOperation, ConnectionServiceInstance);

                    sqlTask = SqlTaskManagerInstance.CreateAndRun <SqlTask>(metadata);
                    sqlTask.StatusChanged += CloseConnection;
                }
                else
                {
                    response.Result = false;
                }

                await requestContext.SendResult(response);
            }
            catch (Exception ex)
            {
                await requestContext.SendError(ex.ToString());
            }
        }
 /// <summary>
 /// For testing purpose only
 /// </summary>
 internal void PerformBackup(BackupOperation backupOperation)
 {
     backupOperation.PerformBackup();
 }
 /// <summary>
 /// For testing purpose only
 /// </summary>
 internal void ScriptBackup(BackupOperation backupOperation)
 {
     backupOperation.Execute(TaskExecutionMode.Script);
 }
 /// <summary>
 /// For testing purpose only
 /// </summary>
 internal void PerformBackup(BackupOperation backupOperation)
 {
     backupOperation.Execute(TaskExecutionMode.ExecuteAndScript);
 }
        internal BackupConfigInfo GetBackupConfigInfo(CDataContainer dataContainer, SqlConnection sqlConnection, string databaseName)
        {
            BackupOperation backupOperation = CreateBackupOperation(dataContainer, sqlConnection);

            return(backupOperation.CreateBackupConfigInfo(databaseName));
        }