private object UseCacheIfNeed(PropertyInfo propertyInfo, object context, BaseSelectorAttribute selectorAttribute) { if (!selectorAttribute.CacheValue) { return(this.SelectPropertyValue(propertyInfo.PropertyType, context, selectorAttribute.Selector)); } if (this.propertyValueCache == null) { this.propertyValueCache = new Dictionary <PropertyInfo, object>(); } if (!this.propertyValueCache.ContainsKey(propertyInfo)) { this.propertyValueCache[propertyInfo] = this.SelectPropertyValue(propertyInfo.PropertyType, context, selectorAttribute.Selector); } return(this.propertyValueCache[propertyInfo]); }
private object UseCacheIfNeed(PropertyInfo propertyInfo, object context, BaseSelectorAttribute selectorAttribute) { if (!selectorAttribute.CacheValue) { return this.SelectPropertyValue(propertyInfo.PropertyType, context, selectorAttribute.Selector); } if (this.propertyValueCache == null) { this.propertyValueCache = new Dictionary<PropertyInfo, object>(); } if (!this.propertyValueCache.ContainsKey(propertyInfo)) { this.propertyValueCache[propertyInfo] = this.SelectPropertyValue(propertyInfo.PropertyType, context, selectorAttribute.Selector); } return this.propertyValueCache[propertyInfo]; }