private async void GenerateScourceDbScripts() { SchemaInfo schemaInfo = this.GetSourceTreeSchemaInfo(); if (!this.ValidateSource(schemaInfo)) { return; } this.btnGenerateSourceScripts.Enabled = false; DatabaseType sourceDbType = this.GetDatabaseType(this.cboSourceDB.Text); int dataBatchSize = SettingManager.Setting.DataBatchSize; DbInterpreterOption sourceScriptOption = new DbInterpreterOption() { ScriptOutputMode = GenerateScriptOutputMode.WriteToFile, DataBatchSize = dataBatchSize }; this.SetGenerateScriptOption(sourceScriptOption); GenerateScriptMode scriptMode = this.GetGenerateScriptMode(); if (scriptMode == GenerateScriptMode.None) { MessageBox.Show("Please specify the script mode."); return; } DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(sourceDbType, this.sourceDbConnectionInfo, sourceScriptOption); SelectionInfo selectionInfo = new SelectionInfo() { UserDefinedTypeNames = schemaInfo.UserDefinedTypes.Select(item => item.Name).ToArray(), TableNames = schemaInfo.Tables.Select(item => item.Name).ToArray(), ViewNames = schemaInfo.Views.Select(item => item.Name).ToArray() }; try { schemaInfo = await dbInterpreter.GetSchemaInfoAsync(selectionInfo); dbInterpreter.Subscribe(this); GenerateScriptMode mode = GenerateScriptMode.None; if (scriptMode.HasFlag(GenerateScriptMode.Schema)) { mode = GenerateScriptMode.Schema; dbInterpreter.GenerateSchemaScripts(schemaInfo); } if (scriptMode.HasFlag(GenerateScriptMode.Data)) { mode = GenerateScriptMode.Data; await dbInterpreter.GenerateDataScriptsAsync(schemaInfo); } this.OpenInExplorer(dbInterpreter.GetScriptOutputFilePath(mode)); MessageBox.Show(DONE); } catch (Exception ex) { this.HandleException(ex); } this.btnGenerateSourceScripts.Enabled = true; }