示例#1
0
        internal static IDictionary <string, PropertyInfo> GetPropertyCache(object obj)
        {
            if (obj == null)
            {
                return(Empty <string, PropertyInfo> .Dictionary);
            }

            var data = RequiredReflected(obj.GetType());

            if (data.Properties == null)
            {
                var props = Template.GetProperties(obj);
                IDictionary <string, PropertyInfo> properties = new Dictionary <string, PropertyInfo>(StringComparer.OrdinalIgnoreCase);

                foreach (var p in props)
                {
                    if (!properties.ContainsKey(p.Name))
                    {
                        properties[p.Name] = p;
                    }
                }
                data.Properties = properties;
            }
            return(data.Properties);
        }
 protected virtual IEnumerable <PropertyInfo> GetTemplateProperties(object obj)
 {
     return(Template.GetProperties(obj));
 }