internal PropertyInfo[] GetPropertiesFromCache(Type type) { if (type == null) { return(new PropertyInfo[0]); } var entityName = type.AssemblyQualifiedName; if (PropertyCache.ContainsKey(entityName)) { PropertyCache.TryGetValue(entityName, out var properties); return(properties); } var props = type.GetTypeInfo().GetProperties(); if (IsAnonymousType(type)) { return(props); } PropertyCache.TryAdd(entityName, props); return(props); }
public PropertyStorage(object value) { Debug.Assert(value != null); Value = value; // Cache the properties so we can know if we've already validated them for duplicates. var type = Value.GetType(); if (!_propertyCache.TryGetValue(type, out Properties)) { Properties = PropertyHelper.GetVisibleProperties(type); ValidatePropertyNames(type, Properties); _propertyCache.TryAdd(type, Properties); } }