public void ManageCommands(Command item)
        {
            if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.RelatedCommands.Add(item);
            }

            GuiModelData.LocalCommands.Add(item);
            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(item);
        }
Example #2
0
        public void ManageStackTraces(Command command)
        {
            var stackTrace = GetStackTrace(command);
            if (stackTrace == null)
                return;

            stackTrace.ApplicationIdentity = command.ApplicationIdentity;
            if (stackTrace.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.RelatedStackTraces.Add(stackTrace);
            }

            _localCallingMethodStackTraces.Add(stackTrace);
            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(stackTrace.ApplicationIdentity);
        }
        private static void runAnalysis(Command command)
        {
            CommandStatistics result;
            if (_commandStatistics.TryGetValue(command.SqlHash, out result))
            {
                command.CommandStatistics = result;
            }
            else
            {
                var counterVisitor = new CounterVisitor();
                RunTSqlFragmentVisitor.AnalyzeFragmentVisitor(command.Sql, command.SqlHash, counterVisitor);

                command.CommandStatistics = counterVisitor.CommandStatistics;
                _commandStatistics.Add(command.SqlHash, counterVisitor.CommandStatistics);
            }
        }
        public void CheckObjectContextsInMultipleThreads(Command item)
        {
            var context = GetContext(item);
            if (context == null)
                return;

            if (context.ManagedThreadId == item.ManagedThreadId)
                return;

            if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.RelatedCommands.Add(item);
            }
            GuiModelData.LocalCommands.Add(item);
            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(item);
        }
Example #5
0
        public void ManageCommand(Command item)
        {
            if (!hasThisContextDuplicateQueriesWithSameHash(item))
                return;

            if (shouldIgnoreAddingThisContext(item))
                return;

            var context = GetContext(item);
            if (context == null)
                return;

            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(item.ApplicationIdentity);

            if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.Contexts.Add(context);
            }

            _localContexts.Add(context);
        }
Example #6
0
        public void ManageStackTraces(Command item)
        {
            if (!HasThisMethodDuplicateQueriesWithSameHash(item))
                return;

            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(item.ApplicationIdentity);

            if (shouldIgnoreAddingThisMethod(item))
                return;

            var stackTrace = GetStackTrace(item);
            if (stackTrace == null)
                return;

            if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.RelatedStackTraces.Add(stackTrace);
            }

            _localCallingMethodStackTraces.Add(stackTrace);
        }
 private static void setNormalizedSqlHash(Command item)
 {
     var result = RunTSqlFragmentVisitor.GetNormalizedSqlHash(item.Sql, item.SqlHash);
     item.NormalizedSqlHash = result.NormalizedSqlHash;
 }
Example #8
0
        protected virtual void OpenCommandToolTip(Command command)
        {
            if (command == null)
                return;

            command.Sql = command.Sql.FormatTSql(command.SqlHash);

            var dlg = PluginContext.CustomDialogsService.CreateCustomContentDialog(
                            new CommandTooltip { Command = command }, "Details", DialogMode.Ok);
            dlg.Show();
        }
Example #9
0
 private bool hasThisContextDuplicateQueriesWithSameHash(Command item)
 {
     return PluginContext.ProfilerData.Commands.Any(
         command => command.ObjectContextId == item.ObjectContextId &&
             command.ApplicationIdentity.Equals(item.ApplicationIdentity) &&
              command.CommandId != item.CommandId &&
              (command.SqlHash.Equals(item.SqlHash, StringComparison.OrdinalIgnoreCase) ||
              command.NormalizedSqlHash.Equals(item.NormalizedSqlHash, StringComparison.OrdinalIgnoreCase)));
 }