private void button1_Click(object sender, EventArgs e)
        {
            var connectionDialog = new ConnectDialog();
            connectionDialog.ShowDialog();

            if (!string.IsNullOrEmpty(connectionDialog.ConnectionString))
            {
                connectionString.Text = connectionDialog.ConnectionString;
            }
        }
Ejemplo n.º 2
0
        void BuildStore()
        {
            if (String.IsNullOrEmpty(ConnectionString))
            {
                var dialog = new ConnectDialog();
                dialog.ShowDialog();
                ConnectionString = dialog.ConnectionString;

                if (String.IsNullOrEmpty(ConnectionString))
                    return;
            }

            Store = new QueryCostStore(new PlanParser(new QueryCostDataGateway(ConnectionString)));
            ShowCosts = false; //caller flips it first time used
        }
Ejemplo n.º 3
0
        public ScriptCoster(DTE dte)
        {
            if (String.IsNullOrEmpty(ConnectionString))
            {
                var dialog = new ConnectDialog();
                dialog.ShowDialog();
                ConnectionString = dialog.ConnectionString;

                if (String.IsNullOrEmpty(ConnectionString))
                    return;
            }

            Dte = dte;
            Store = new QueryCostStore(new PlanParser(new QueryCostDataGateway(ConnectionString)));
            ShowCosts = false; //caller flips it first time used
        }
Ejemplo n.º 4
0
        public static void DeployFile(string newCode)
        {
            if (String.IsNullOrEmpty(ConnectionString))
            {
                var connectDialog = new ConnectDialog();
                connectDialog.ShowDialog();
                ConnectionString = connectDialog.ConnectionString;

                if (String.IsNullOrEmpty(ConnectionString))
                    return;
            }

            var procedures = ScriptDom.GetProcedures(newCode);
            var deployScripts = new List<string>();

            foreach (var procedure in procedures)
            {
                OutputPane.WriteMessage("Deploying {0}", procedure.ProcedureReference.Name.ToQuotedString());
                Deploy(BuildIfNotExistsStatements(procedure));
                Deploy(ChangeCreateToAlter(procedure, newCode));
                OutputPane.WriteMessage("Deploying {0}...Done", procedure.ProcedureReference.Name.ToQuotedString());
            }

            var functions = ScriptDom.GetFunctions(newCode);
            foreach (var function in functions)
            {
                OutputPane.WriteMessage("Deploying {0}", function.Name.ToQuotedString());
                if (function.ReturnType is SelectFunctionReturnType)
                {
                    Deploy(BuildIfNotExistsStatementsInlineFunction(function));
                }
                else
                {
                    Deploy(BuildIfNotExistsStatements(function));
                }

                Deploy(ChangeCreateToAlter(function, newCode));
                OutputPane.WriteMessage("Deploying {0}...Done", function.Name.ToQuotedString());

            }

            foreach (var statement in deployScripts)
            {
                Deploy(statement);
            }
            //Deploy();
        }
Ejemplo n.º 5
0
        private void Start(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(_connectionString))
            {
                var dialog = new ConnectDialog();
                dialog.ShowDialog();
                _connectionString = dialog.ConnectionString;

                if (String.IsNullOrEmpty(_connectionString))
                    return;
            }

            Task.Run(() =>
            {
                _reader = new ExtendedEventDataDataReader(_connectionString);
                _reader.Start();
            });


            StartButton.IsEnabled = false;
            StopButton.IsEnabled = true;

        }
        private void Start(object sender, RoutedEventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(_connectionString))
                {
                    var dialog = new ConnectDialog();
                    dialog.ShowDialog();
                    _connectionString = dialog.ConnectionString;

                    if (String.IsNullOrEmpty(_connectionString))
                        return;
                }

                Task.Run(() =>
                {
                    try
                    {
                        _reader = new ExtendedEventDataDataReader(_connectionString);
                        _reader.Start();
                    }
                    catch (Exception ex)
                    {
                        OutputPane.WriteMessageAndActivatePane("SSDTDevPack: CodeCoverage: Exception calling Start (Worker Thread): {0}", ex);
                    }
                });

                StartButton.IsEnabled = false;
                StopButton.IsEnabled = true;
            }
            catch (Exception ex)
            {
                OutputPane.WriteMessageAndActivatePane("SSDTDevPack: CodeCoverage: Exception calling Start (UI Thread): {0}", ex);
            }
        }