public override object ExecuteScalar()
 {
     CommandStrings.Add(CommandText);
     ExecutedParameterCollections.Add(new FakeParameterCollection(_parameters));
     ExecuteScalarInvoked = true;
     return(ExecuteScalarResult);
 }
 public override int ExecuteNonQuery()
 {
     ExecutedParameterCollections.Add(new FakeParameterCollection(_parameters));
     CommandStrings.Add(CommandText);
     ExecuteNonQueryInvoked = true;
     return(ExecuteNonQueryResult);
 }
Exemple #3
0
        /// <summary>
        /// Creates a ShellCommandEntry for each command in a given command library, and inserts the command's
        /// name into CommandStrings to make it a valid command according to the parser.
        /// </summary>
        /// <param name="commands"> An enumerable object containing a set of command descriptors. </param>
        /// <param name="handler"> A handler to be associated with the set of command descriptors. </param>
        /// <returns> Returns true on success and false if a command is rejected. </returns>
        public bool registerCommands(IEnumerable <CommandDescriptor> commands, ICommandHandler handler)
        {
            try
            {
                foreach (var command in commands)
                {
                    _commands.Add(
                        command.Name.ToLower(),
                        new ShellCommandEntry
                    {
                        Descriptor = command,
                        Handler    = handler
                    }
                        );
                    CommandStrings.Add(command.Name);
                }

                return(true);
            }
            catch (Exception e)
            {
                Processor.Executor.WriteInfoText(e.Message);
                return(false);
            }
        }
Exemple #4
0
        public void AddCommand(string commandstring)
        {
            CommandStrings.Add(commandstring);
            ArgumentNode an = new ArgumentNode(commandstring);

            if (an.Key != null)
            {
                Commands.Add(an.Key, an);
            }
            else
            {
                throw new ArgumentException("Outermost command must have a name");
            }
        }
 public new IDataReader ExecuteReader(CommandBehavior behavior)
 {
     CommandStrings.Add(CommandText);
     ExecutedParameterCollections.Add(new FakeParameterCollection(_parameters));
     return(ExecuteReaderResult);
 }
 protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
 {
     CommandStrings.Add(CommandText);
     ExecutedParameterCollections.Add(new FakeParameterCollection(_parameters));
     return(new FakeDataReader(NextResult.Clone()));
 }