public object Get <T>(Expression <Func <T> > labda) { string id = Objects.fullname(labda); return(this.Get(id));; }
public static Dictionary <object, object> ExtractDictionary(object source, Dictionary <Type, List <string> > properties, int deep = int.MaxValue, bool invoked = false) { Type TSource = source.GetType(); string sSourceName = Asmodat.Abbreviate.Objects.nameof(source); Dictionary <object, object> DO2Data = new Dictionary <object, object>(); if (sSourceName == null) { return(null); } Dictionary <object, object> DPIOProperties = Objects.GetProperties(source, false); if (DPIOProperties == null || DPIOProperties.Count <= 0 || deep <= 0) { return(null); } foreach (var v in DPIOProperties) { if (v.Value == null) { continue; } Type TValue = v.Value.GetType(); if (properties.ContainsKey(TSource) && properties[TSource].Contains(v.Key)) { DO2Data.Add(v.Key, v.Value); DO2Data.Add((v.Key + sNodeKeyID), null); } else if (deep > 1) { if (v.Value is IEnumerable && v.Value is ICollection) { var vSubZeroData = new Dictionary <object, object>(); var vOEnum = (v.Value as IEnumerable); foreach (object o in vOEnum) { var vSubData = ExtractDictionary(o, properties, deep - 1); if (vSubData != null && vSubData.Count > 0) { vSubZeroData.Add(Objects.nameof(o), vSubData); } } if (vSubZeroData != null && vSubZeroData.Count > 0) { DO2Data.Add(v.Key, vSubZeroData); } } var vSubOneData = ExtractDictionary(v.Value, properties, deep - 1); if (vSubOneData != null && vSubOneData.Count > 0) { DO2Data.Add(v.Key, vSubOneData); } } } if (DO2Data != null && DO2Data.Count > 0) { return(DO2Data); } else { return(null); } }
public void Set <T>(Expression <Func <T> > labda, ThreeState value) { string id = Objects.fullname(labda); this.Set(id, value); }