Beispiel #1
0
        private static void WriteStringifiedObject(object o, TextWriter w)
        {
            IStringifier stringifier = null;
            var          t           = o.GetType();

            while (stringifier == null && t != null)
            {
                stringifier = StringifierLibrary.Instance.All.SingleOrDefault(x => x.SupportedType == t);
                t           = t.BaseType;
            }
            if (stringifier == null)
            {
                throw new Exception("Can't find stringifier to deserialize " + o.GetType());
            }
            w.WriteLine("s:" + stringifier.Stringify(o) + ";");
        }
        protected virtual int RenderDetailRows(StringBuilder tableText, List <IValueGetter <TRow> > shownColumns)
        {
            var rowCount = 0;

            foreach (var row in GetRows(_maxRows))
            {
                tableText.Append("<tr>");
                tableText.Append($"<td>{rowCount}</td>");
                foreach (var p in shownColumns)
                {
                    var t = _stringifier.Stringify(p.Title, p.ValueType, p.GetValue(row));
                    tableText.Append($"<td>{t}</td>");
                }

                tableText.Append("</tr>");
                rowCount++;
            }

            return(rowCount);
        }