public void Backup(Stream stream)
        {
            var httpClient = new HttpClient();
            var loginCommand = new LoginCommand(_connectionInfo);

            var loginTask =  loginCommand.Execute(httpClient);
            loginTask.Wait();

            var backupCommand = new BackupCommand(_connectionInfo);
            var backupTask = backupCommand.Execute(httpClient, stream);
            backupTask.Wait();

            if (!backupTask.Result)
                throw new Exception("could not backup the database");

            if (stream.Length == 0 || stream.Length / 1000 < 1000)
                throw new Exception("could not backup the database, backup to small");
        }
예제 #2
0
        public void Backup(Stream stream)
        {
            var httpClient   = new HttpClient();
            var loginCommand = new LoginCommand(_connectionInfo);

            var loginTask = loginCommand.Execute(httpClient);

            loginTask.Wait();

            var backupCommand = new BackupCommand(_connectionInfo);
            var backupTask    = backupCommand.Execute(httpClient, stream);

            backupTask.Wait();

            if (!backupTask.Result)
            {
                throw new Exception("could not backup the database");
            }

            if (stream.Length == 0 || stream.Length / 1000 < 1000)
            {
                throw new Exception("could not backup the database, backup to small");
            }
        }