Beispiel #1
0
 /// <summary>
 /// Run a shell command in current database. Returns a BsonValue as result
 /// </summary>
 public BsonValue RunCommand(string command)
 {
     if (_shell == null)
     {
         _shell = new LiteShell(this);
     }
     return(_shell.Run(command));
 }
Beispiel #2
0
        /// <summary>
        /// Run a command shell formating $0, $1 to JSON string args item index
        /// </summary>
        public BsonValue Run(string command, params BsonValue[] args)
        {
            var shell = new LiteShell();

            var cmd = Regex.Replace(command, @"\$(\d+)", (k) =>
            {
                var index = Convert.ToInt32(k.Groups[1].Value);
                return(JsonSerializer.Serialize(args[index]));
            });

            return(shell.Run(_engine.Value, cmd));
        }
Beispiel #3
0
        /// <summary>
        /// Run a command shell
        /// </summary>
        public BsonValue Run(string command)
        {
            var shell = new LiteShell();

            return(shell.Run(_engine.Value, command));
        }