public IDataInput Let <D>(out D v, int proj = 0x00ff) where D : IData, new() { try { int ord = ordinal++; if (!reader.IsDBNull(ord)) { string str = reader.GetString(ord); JsonParse p = new JsonParse(str); JObj jo = (JObj)p.Parse(); v = new D(); v.Read(jo, proj); // add shard if any IShardable sharded = v as IShardable; if (sharded != null) { sharded.Shard = service.Shard; } return(this); } } catch { } v = default(D); return(this); }
public bool Get <D>(string name, ref D[] v, int proj = 0x00ff) where D : IData, new() { try { int ord = reader.GetOrdinal(name); if (!reader.IsDBNull(ord)) { string str = reader.GetString(ord); JsonParse parse = new JsonParse(str); JArr ja = (JArr)parse.Parse(); int len = ja.Count; v = new D[len]; for (int i = 0; i < len; i++) { JObj jo = ja[i]; D obj = new D(); obj.Read(jo, proj); // add shard if any IShardable sharded = obj as IShardable; if (sharded != null) { sharded.Shard = service.Shard; } v[i] = obj; } return(true); } } catch { } return(false); }
public bool Get <D>(string name, ref D v, int proj = 0x00ff) where D : IData, new() { try { int ord = reader.GetOrdinal(name); if (!reader.IsDBNull(ord)) { string str = reader.GetString(ord); JsonParse p = new JsonParse(str); JObj jo = (JObj)p.Parse(); v = new D(); v.Read(jo, proj); // add shard if any IShardable sharded = v as IShardable; if (sharded != null) { sharded.Shard = service.Shard; } return(true); } } catch { } return(false); }
// // RESULTSET // public D ToObject <D>(int proj = 0x00ff) where D : IData, new() { D obj = new D(); obj.Read(this, proj); // add shard if any IShardable sharded = obj as IShardable; if (sharded != null) { sharded.Shard = service.Shard; } return(obj); }
public List <D> ToList <D>(int proj = 0x00ff) where D : IData, new() { List <D> coll = new List <D>(32); while (Next()) { D obj = new D(); obj.Read(this, proj); // add shard if any IShardable sharded = obj as IShardable; if (sharded != null) { sharded.Shard = service.Shard; } coll.Add(obj); } return(coll); }
public Map <K, D> ToMap <K, D>(Func <D, K> keyer, int proj = 0x00ff) where D : IData, new() where K : IEquatable <K> { int initial = doerCtx?.Doer?.Limit ?? 32; Map <K, D> coll = new Map <K, D>(initial); while (Next()) { D obj = new D(); obj.Read(this, proj); // add shard name if any IShardable sharded = obj as IShardable; if (sharded != null) { sharded.Shard = service.Shard; } K key = keyer(obj); coll.Add(key, obj); } return(coll); }