Beispiel #1
0
        public static void PropertyPathHelper_Test()
        {
            var a = new A();

            object valueA  = PropertyPathHelper.GetValueFromPropertyInfo(a, "Value");
            object valueB  = PropertyPathHelper.GetValueFromPropertyInfo(a, "B.Value");
            object valueC  = PropertyPathHelper.GetValueFromPropertyInfo(a, "B.C.Value");
            bool   cachedA =
                PropertyPathHelper._cacheDic.ContainsKey(new Tuple <Type, string>(typeof(A), "Value"));
            bool cachedC =
                PropertyPathHelper._cacheDic.ContainsKey(new Tuple <Type, string>(typeof(C), "Value"));


            Assert.AreEqual("A", valueA);
            Assert.AreEqual("B", valueB);
            Assert.AreEqual("C", valueC);
            Assert.AreEqual("C", valueC);

            Assert.IsTrue(cachedA);
            Assert.IsTrue(cachedC);
        }
Beispiel #2
0
 protected virtual IEnumerable getSubEntries(object item)
 {
     return(PropertyPathHelper.GetValueFromPropertyInfo(item, SubentriesPath) as IEnumerable);
 }
Beispiel #3
0
 protected virtual string getValuePath(object item)
 {
     return(PropertyPathHelper.GetValueFromPropertyInfo(item, ValuePath) as string);
 }
Beispiel #4
0
 protected virtual object getParent(object item)
 {
     return(PropertyPathHelper.GetValueFromPropertyInfo(item, ParentPath));
 }
Beispiel #5
0
 protected virtual string GetValuePath(object item) =>
 PropertyPathHelper.GetValueFromPropertyInfo(item, ValuePath) as string;
Beispiel #6
0
 protected virtual object GetParent(object item) =>
 PropertyPathHelper.GetValueFromPropertyInfo(item, ParentPath);