示例#1
0
        /// <summary>
        /// Retrieve property path info.
        /// Throw error if unavailable.
        /// This only examines public instance properties.
        /// </summary>
        /// <param name="t"></param>
        /// <param name="propertyPathString"></param>
        /// <param name="cacheProvider"></param>
        /// <returns></returns>
        private static IPropertyPath GetPropertyPath(Type t, String propertyPathString, ICacheService cacheProvider)
        {
            String        cacheKey     = null;
            IPropertyPath propertyPath = null;

            if (cacheProvider != null)
            {
                cacheKey     = t.FullName + "#" + propertyPathString;
                propertyPath = cacheProvider[cacheKey] as IPropertyPath;
            }
            if (propertyPath == null)
            {
                if (propertyPathString.IndexOf('.') > -1)
                {
                    propertyPath = new ComplexPropertyPath(t, propertyPathString);
                }
                else
                {
                    propertyPath = new SimplePropertyPath(t, propertyPathString);
                }
                if (cacheProvider != null)
                {
                    cacheProvider[cacheKey] = propertyPath;
                }
            }
            return(propertyPath);
        }
示例#2
0
 /// <summary>
 /// Retrieve property path info.
 /// Throw error if unavailable.
 /// This only examines public instance properties.
 /// </summary>
 /// <param name="t"></param>
 /// <param name="propertyPathString"></param>
 /// <param name="cacheProvider"></param>
 /// <returns></returns>
 private static IPropertyPath GetPropertyPath(Type t, String propertyPathString, ICacheService cacheProvider)
 {
     String cacheKey = null;
     IPropertyPath propertyPath = null;
     if (cacheProvider != null)
     {
         cacheKey = t.FullName + "#" + propertyPathString;
         propertyPath = cacheProvider[cacheKey] as IPropertyPath;
     }
     if (propertyPath == null)
     {
         if (propertyPathString.IndexOf('.') > -1)
         {
             propertyPath = new ComplexPropertyPath(t, propertyPathString);
         }
         else
         {
             propertyPath = new SimplePropertyPath(t, propertyPathString);
         }
         if (cacheProvider != null)
         {
             cacheProvider[cacheKey] = propertyPath;
         }
     }
     return propertyPath;
 }