Пример #1
0
        /// <summary>
        /// Run a shell command from a string. Execute command in current database and returns an IEnumerable collection of results
        /// </summary>
        public IList <BsonValue> Run(string command)
        {
            if (_commands.Count == 0)
            {
                RegisterCommands();
            }

            var s = new StringScanner(command);

            // test all commands
            foreach (var cmd in _commands)
            {
                if (!cmd.IsCommand(s))
                {
                    continue;
                }

                var values = cmd.Execute(s, this);

                return(values.ToList());
            }

            throw LiteException.InvalidCommand(command);
        }