Ejemplo n.º 1
0
        private static void UpcodeToSqlLog(XmlReader reader, List <ElmahLogSqlEntry> log)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }

            Debug.Assert(!reader.IsEmptyElement);
            reader.Read();



            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.IsStartElement("sql"))
                {
                    var entry = new ElmahLogSqlEntry
                    {
                        CommandType = reader.GetAttribute("command-type"),
                        SqlText     = reader.GetAttribute("sql-text"),
                        TimeStamp   = LoadTime(reader.GetAttribute("time-stamp") ?? string.Empty),
                        DurationMs  = int.Parse(reader.GetAttribute("duration") ?? "0")
                    };

                    log.Add(entry);

                    reader.Read(); // <item>
                }
                else
                {
                    reader.Skip();
                }

                reader.MoveToContent();
            }

            reader.ReadEndElement();
        }
Ejemplo n.º 2
0
 public void AddSql(Guid id, ElmahLogSqlEntry entry)
 {
     _map.Add(id, entry);
 }