public Dictionary <string, object>[] get_session_Id(RequestCommands request)
        {
            var report = _history.Find(request.Id);

            if (report == null)
            {
                return(new Dictionary <string, object> [0]);
            }

            return(report.Steps.Select(x => x.Log).OfType <CommandExecuted>().Select(cmd =>
            {
                var dict = new Dictionary <string, object> {
                    { "sql", cmd.CommandText }, { "args", cmd.Args }
                };


                if (cmd is CommandFailed)
                {
                    dict.Add("success", false);
                    dict.Add("error", cmd.As <CommandFailed>().ExceptionText);
                }
                else
                {
                    dict.Add("success", true);
                }

                return dict;
            }).ToArray());
        }
Beispiel #2
0
        public Dictionary <string, object> get_request_Id(ChainExecutionLog query)
        {
            var log = _history.Find(query.Id);

            var dict = new Dictionary <string, object>();

            if (log != null)
            {
                dict.Add("log", log.ToDictionary());
                if (log.RootChain != null)
                {
                    dict.Add("type", log.RootChain.GetType().Name);
                }
            }

            return(dict);
        }