public void WriteDbValue(DbValue value) { switch (value.Kind) { case S: WriteString(value.ToString()); break; case B: WriteValue("B", value.ToString()); break; case BOOL: WriteBool(value.ToBoolean()); break; case BS: WriteSet("BS", value.ToSet <byte[]>()); break; case SS: WriteSet("SS", value.ToSet <string>()); break; case NS: WriteSet("NS", value.ToSet <string>()); break; case L: WriteList((IEnumerable <DbValue>)value.Value); break; case N: WriteValue("N", value.ToString()); break; case M: WriteMap((AttributeCollection)value.Value); break; default: throw new Exception("Unexpected type:" + value.Kind); } }