public MongoReturnDataList <T> Copy(bool Deeply = false) { MongoReturnDataList <T> ret = new MongoReturnDataList <T>(); this.ForEach(a => ret.Add(Deeply ? a.Clone <T>():a)); return(ret); }
public object Clone() { MongoReturnDataList <T> ret = new MongoReturnDataList <T>(); this.ForEach(a => ret.Add(a.Clone() as T)); return(ret); }
public MongoReturnDataList <T> GetDataByIndies(int[] indies) { MongoReturnDataList <T> ret = new MongoReturnDataList <T>(); for (int i = 0; i < indies.Length; i++) { ret.Add(this[indies[i]]); } return(ret); }
public MongoReturnDataList <T> Query(BsonDocument func) { MongoReturnDataList <T> ret = new MongoReturnDataList <T>(); try { List <T> list = this.FindAll(p => (p as MongoData).Compr(func)); //this.Clear(); list.ForEach(p => ret.Add(p)); } catch (Exception ce) { LogLib.LogableClass.ToLog("结果链查询", ce.Message); } return(ret); }
public MongoReturnDataList <T> Query <Field>(string col, Field val) { MongoReturnDataList <T> ret = new MongoReturnDataList <T>(); try { BsonElement bs = new BsonElement(col, BsonValue.Create(val)); //LogLib.LogableClass.ToLog("查询条件", string.Format("{0}=>{1}",col,val)); List <T> list = this.FindAll(p => p.Compr(bs) == true); //this.Clear(); list?.ForEach(p => ret.Add(p)); } catch (Exception ce) { LogLib.LogableClass.ToLog(string.Format("结果链查询错误[{0}]", ce.Message), ce.StackTrace); } return(ret); }
public static MongoDataDictionary <T> ToDirectionary(MongoReturnDataList <T> list, string keyName) { MongoDataDictionary <T> ret = new MongoDataDictionary <T>(); if (list == null) { return(null); } for (int i = 0; i < list.Count; i++) { DetailStringClass obj = list[i] as DetailStringClass; string key = obj.getValue(keyName)?.ToString(); MongoReturnDataList <T> sublist = new MongoReturnDataList <T>(); if (!ret.ContainsKey(key)) { ret.Add(key, sublist); } sublist = ret[key]; sublist.Add(list[i]); ret[key] = sublist; } return(ret); }