public void RunAnalysisVisitor(CommandResult commandResult)
        {
            if (hasNotMoreThanOneReturnedRow(commandResult))
            {
                return;
            }

            var command = PluginContext.ProfilerData.Commands
                .FirstOrDefault(x => x.CommandId == commandResult.CommandId &&
                                     x.ApplicationIdentity.Equals(commandResult.ApplicationIdentity));
            if (command == null)
                return;

            RunAnalysisVisitorOnCommand(new UnboundedResultSetVisitor(), command);
        }
        public void AddExceptionalCommands(CommandResult commandResult)
        {
            if (string.IsNullOrWhiteSpace(commandResult.Exception))
                return;

            var command = PluginContext.ProfilerData.Commands
                                        .FirstOrDefault(cmd => cmd.CommandId == commandResult.CommandId &&
                                                        cmd.ApplicationIdentity.Equals(commandResult.ApplicationIdentity));
            if (command == null)
                return;

            if (commandResult.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
            {
                GuiModelData.RelatedCommands.Add(command);
            }

            GuiModelData.LocalCommands.Add(command);

            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(commandResult);
        }
        public void RunAnalysisVisitor(CommandResult commandResult)
        {
            if (commandResult.Columns == null || !commandResult.Columns.Any())
            {
                return;
            }

            if (!commandResult.Columns.Any(column => column.DataType == "System.Single" ||
                                                     column.DataType == "System.Double")) return;
            var command = PluginContext.ProfilerData.Commands
                .FirstOrDefault(cmd => cmd.CommandId == commandResult.CommandId &&
                                     cmd.ApplicationIdentity.Equals(commandResult.ApplicationIdentity));
            if (command == null)
                return;

            if (Equals(GuiModelData.SelectedApplicationIdentity, command.ApplicationIdentity))
            {
                GuiModelData.RelatedCommands.Add(command);
            }
            GuiModelData.LocalCommands.Add(command);
            PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
            UpdateAppIdentityNotificationsCount(command);
        }
 private static bool hasNotMoreThanOneReturnedRow(CommandResult commandResult)
 {
     return !string.IsNullOrWhiteSpace(commandResult.Exception) ||
            commandResult.RowsReturned == null ||
            commandResult.RowsReturned.Value <= 1;
 }