private bool CanExecuteQuery() { var canExecute = DatabaseSelectionController.HasDbConnectionFactory() && !string.IsNullOrWhiteSpace(ClassName.Value) && !string.IsNullOrWhiteSpace(SqlQuery.Value); return(canExecute); }
private void GenerateDesignTimeCode() { try { var json = DatabaseSelectionController.GetQueryResultsAsJson(SqlQuery.Value); DesignTimeDataCode.Value = DesignTimeDataCodeTemplate.CreateCode(ClassName.Value, json, GeneratedCSharpText.Value); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
private void GenerateCSharpClassDefinition() { try { var options = new CSharpClassTextGeneratorOptions(); options.IncludePropertyAnnotationAttributes = IncludePropertyAttributes.Value; var conn = DatabaseSelectionController.GetDbConnection(); GeneratedCSharpText.Value = CSharpClassGeneratorFromAdoDataReader.GenerateClass(conn, SqlQuery.Value, ClassName.Value, options); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
private void PopulateDataTable() { try { var sw = Stopwatch.StartNew(); var dataTable = DatabaseSelectionController.GetDataTable(SqlQuery.Value); var elapsedTime = sw.Elapsed; var customJson = dataTable.ToCustomJson(Formatting.None); DataSize.Value = customJson.Length; var gzipLength = GetGzipLength(customJson); QueryTabName.Value = $"Query Results {elapsedTime:s\\.fff}s | Rows: {dataTable.Rows.Count} | Size: {DataSize.Value / 1024:N1} KB | Compressed: {gzipLength / 1024:N1} KB"; Datatable.Value = dataTable; } catch (Exception e) { MessageBox.Show(e.ToString()); } }