/// <summary> /// Executes the specified <paramref name="sql"/> statement. /// </summary> /// <param name="sql">The SQL statment.</param> /// <returns>The SQL statement.</returns> public SqlStatement ExecuteSql(string sql) { SqlStatement stm = new SqlStatement(this, sql); MigrationSteps.Enqueue(stm); return(stm); }
/// <summary> /// Alters the <see cref="Table"/> with the specified <paramref name="name"/>. /// </summary> /// <param name="name">The name.</param> /// <returns>The table.</returns> public Table AlterTable(string name) { Table t = new Table(this, name, Modifier.Alter); MigrationSteps.Enqueue(t); return(t); }
/// <summary> /// Process the ok button click event. /// </summary> /// <param name="sender">Hosting user control.</param> /// <param name="e">We dont use the routing args with this implementation.</param> private void ButtonOk_Click(object sender, RoutedEventArgs e) { //Loading the selected projects from the dialog VsProject webformProject = ComboboxWebFormsProject.SelectedItem as VsProject; VsProject blazorProject = ComboboxBlazorProject.SelectedItem as VsProject; //Checking that a source webforms project has been selected. if (webformProject == null) { MessageBox.Show("You must select a Webforms Project before continuing."); return; } //Checking to make sure a target blazor project has been selected. if (blazorProject == null) { MessageBox.Show("You must have a Blazor Project selected before continuing."); return; } //Checking to make sure the same project was not selected. if (webformProject.Name == blazorProject.Name) { MessageBox.Show("The web forms project and the blazor project cannot be the same."); return; } bool migrationStepsSelected = false; migrationStepsSelected = CheckBoxMigrateAspxPages.IsChecked.GetResult() | CheckBoxMigrateBundling.IsChecked.GetResult() | CheckBoxMigrateConfiguration.IsChecked.GetResult() | CheckBoxMigrateHttpModules.IsChecked.GetResult() | CheckBoxMigrateLogic.IsChecked.GetResult() | CheckBoxMigrateStaticFiles.IsChecked.GetResult() | CheckBoxStartupProcess.IsChecked.GetResult(); if (!migrationStepsSelected) { MessageBox.Show("You have to select a migration step in order to continue."); return; } try { var migrationSteps = new MigrationSteps(CheckBoxStartupProcess.IsChecked.GetResult(), CheckBoxMigrateHttpModules.IsChecked.GetResult(), CheckBoxMigrateStaticFiles.IsChecked.GetResult(), CheckBoxMigrateBundling.IsChecked.GetResult(), CheckBoxMigrateAspxPages.IsChecked.GetResult(), CheckBoxMigrateConfiguration.IsChecked.GetResult(), CheckBoxMigrateLogic.IsChecked.GetResult()); //Creating an empty observable collection. This will be updated during the execution of the migration process. StepStatus = new ObservableCollection <MigrationStepStatus>(); //Updating the dialog to not accept input while the migration is processing ButtonOk.Content = "Processing"; ButtonOk.IsEnabled = false; ButtonCancel.IsEnabled = false; //Creating the migration process logic. Notice that we pass in a copy of the visual studio actions that code factory uses for visual studio automation. //In addition we pass a reference to the dialog itself. //We have implemented an interface on the dialog that allows the background thread to call into this dialog and update the migration status. var migrationProcess = new WebFormToBlazorServerMigration(_visualStudioActions, this); //Updating the UI to begin the migration process. SetupStatusForMigration(migrationSteps); //Starting the migration process on a background thread and letting the dialog keep processing UI updates. Task.Run(() => migrationProcess.StartMigration(webformProject, blazorProject, migrationSteps)); } catch (Exception unhandledError) { //Displaying the error that was not managed during the migration process. MessageBox.Show($"The following unhandled error occured while performing the setup operations. '{unhandledError.Message}'", "Unhandled Setup Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Drops the <see cref="Table"/> with the specified /// <paramref name="name"/> from the <see cref="Database"/>. /// </summary> /// <param name="name">The name.</param> public void DropTable(string name) { MigrationSteps.Enqueue(new Table(this, name, Modifier.Drop)); }
/// <summary> /// Helper that configures the screen once the migration process has begun. /// </summary> /// <param name="steps">The migration steps to be performed.</param> private void SetupStatusForMigration(MigrationSteps steps) { //Updating logic step CheckBoxMigrateLogic.Visibility = Visibility.Collapsed; TextBlockMigrateLogicStatus.Visibility = Visibility.Visible; if (!steps.AppLogic) { TextBlockMigrateLogicStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating the Http Modules step CheckBoxMigrateHttpModules.Visibility = Visibility.Collapsed; TextBlockMigrateHttpModulesStatus.Visibility = Visibility.Visible; if (!steps.HttpModules) { TextBlockMigrateHttpModulesStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating the static files step. CheckBoxMigrateStaticFiles.Visibility = Visibility.Collapsed; TextBlockMigrateStaticFilesStatus.Visibility = Visibility.Visible; if (!steps.StaticFiles) { TextBlockMigrateStaticFilesStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating Aspx Page s step CheckBoxMigrateAspxPages.Visibility = Visibility.Collapsed; TextBlockMigrateAspxPagesStatus.Visibility = Visibility.Visible; if (!steps.AspxPages) { TextBlockMigrateAspxPagesStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating the Bundling step CheckBoxMigrateBundling.Visibility = Visibility.Collapsed; TextBlockMigrateBundlingStatus.Visibility = Visibility.Visible; if (!steps.Bundling) { TextBlockMigrateBundlingStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating the configuration step CheckBoxMigrateConfiguration.Visibility = Visibility.Collapsed; TextBlockMigrateConfigurationStatus.Visibility = Visibility.Visible; if (!steps.Configuration) { TextBlockMigrateConfigurationStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating the app logic step CheckBoxMigrateLogic.Visibility = Visibility.Collapsed; TextBlockMigrateLogicStatus.Visibility = Visibility.Visible; if (!steps.AppLogic) { TextBlockMigrateLogicStatus.TextDecorations = TextDecorations.Strikethrough; } //Updating the startup logic step CheckBoxStartupProcess.Visibility = Visibility.Collapsed; TextBlockStartupProcessStatus.Visibility = Visibility.Visible; if (!steps.Startup) { TextBlockStartupProcessStatus.TextDecorations = TextDecorations.Strikethrough; } //Displaying the migration process status TextBlock. TextBlockMigrationProcessStatus.Visibility = Visibility.Visible; }