ODBEntity, ODBValue, etc. added TreeString
parent
7280cdf1d4
commit
5cf57e6a2b
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using ln.types.odb.values;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
namespace ln.types.odb.ng
|
||||
{
|
||||
public class Document : ODBEntity
|
||||
|
@ -129,6 +130,21 @@ namespace ln.types.odb.ng
|
|||
{
|
||||
return String.Format("[Document ID={0} {1}]", ID.ToString(),String.Join(" ",properties.Select(kv=> String.Format("{0}={1}",kv.Key,kv.Value))));
|
||||
}
|
||||
public override string ToTreeString(int indent)
|
||||
{
|
||||
indent += 2;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
stringBuilder.AppendFormat("{0} Identity={1} Count={2}", GetType().Name, Identity, properties.Count);
|
||||
foreach (ODBValue key in properties.Keys)
|
||||
{
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.AppendFormat("{0}{1,-32}: {2}", new String(' ', indent), key, properties[key].ToTreeString(indent));
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using ln.types.odb.ng;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* typeCode list
|
||||
|
@ -195,7 +196,10 @@ namespace ln.types.odb.values
|
|||
return String.Format("[{0} Identity={1}]", GetType().Name, Identity);
|
||||
}
|
||||
|
||||
static ODBEntity()
|
||||
public string TreeString => ToTreeString(0);
|
||||
public abstract string ToTreeString(int indent);
|
||||
|
||||
static ODBEntity()
|
||||
{
|
||||
RuntimeHelpers.RunClassConstructor(typeof(ODBNull).TypeHandle);
|
||||
RuntimeHelpers.RunClassConstructor(typeof(Document).TypeHandle);
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ln.types.odb.ng;
|
||||
using System.Text;
|
||||
namespace ln.types.odb.values
|
||||
{
|
||||
public class ODBList : ODBEntity, IEnumerable<ODBEntity>
|
||||
|
@ -120,6 +121,20 @@ namespace ln.types.odb.values
|
|||
RegisterDeserializer(0x02, (b, o, l) => new ODBList(b,o,l));
|
||||
}
|
||||
|
||||
public override string ToTreeString(int indent)
|
||||
{
|
||||
indent += 2;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
stringBuilder.AppendFormat("{0} Identity={1} Count={2}", GetType().Name, Identity, Count);
|
||||
foreach (ODBEntity entity in items)
|
||||
{
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.AppendFormat("{0}{1}", new String(' ', indent), entity.ToTreeString(indent));
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// *
|
||||
// **/
|
||||
using System;
|
||||
using System.Text;
|
||||
namespace ln.types.odb.values
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -45,27 +46,31 @@ namespace ln.types.odb.values
|
|||
return String.Format("[{0} Value={1}]", GetType().Name, Value);
|
||||
}
|
||||
|
||||
public override string ToTreeString(int indent)
|
||||
{
|
||||
return String.Format("{0} Value={1}", GetType().Name, Value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//public virtual string AsString => As<string>();
|
||||
//public virtual bool AsBool => As<bool>();
|
||||
//public virtual byte AsByte => As<byte>();
|
||||
//public virtual char AsChar => (char)Value;
|
||||
//public virtual short AsShort => Convert.ToInt16(Value);
|
||||
//public virtual int AsInt => Convert.ToInt32(Value);
|
||||
//public virtual long AsLong => Convert.ToInt64(Value);
|
||||
//public virtual ushort AsUShort => Convert.ToUInt16(Value);
|
||||
//public virtual uint AsUInt => (uint)Value;
|
||||
//public virtual ulong AsULong => (ulong)Value;
|
||||
//public virtual string AsString => As<string>();
|
||||
//public virtual bool AsBool => As<bool>();
|
||||
//public virtual byte AsByte => As<byte>();
|
||||
//public virtual char AsChar => (char)Value;
|
||||
//public virtual short AsShort => Convert.ToInt16(Value);
|
||||
//public virtual int AsInt => Convert.ToInt32(Value);
|
||||
//public virtual long AsLong => Convert.ToInt64(Value);
|
||||
//public virtual ushort AsUShort => Convert.ToUInt16(Value);
|
||||
//public virtual uint AsUInt => (uint)Value;
|
||||
//public virtual ulong AsULong => (ulong)Value;
|
||||
|
||||
//public virtual double AsDouble => (double)Value;
|
||||
//public virtual float AsFloat => (float)Value;
|
||||
//public virtual double AsDouble => (double)Value;
|
||||
//public virtual float AsFloat => (float)Value;
|
||||
|
||||
//public virtual Guid AsGuid => (Guid)Value;
|
||||
//public virtual DateTime AsDateTime => (DateTime)Mapper.Default.UnmapValue(typeof(DateTime), this);
|
||||
//public virtual TimeSpan AsTimeSpan => (TimeSpan)Mapper.Default.UnmapValue(typeof(TimeSpan), this);
|
||||
}
|
||||
//public virtual Guid AsGuid => (Guid)Value;
|
||||
//public virtual DateTime AsDateTime => (DateTime)Mapper.Default.UnmapValue(typeof(DateTime), this);
|
||||
//public virtual TimeSpan AsTimeSpan => (TimeSpan)Mapper.Default.UnmapValue(typeof(TimeSpan), this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue