public Dictionary<string, MemberMetadata> GetCatelProperties(Type type, bool includeModelBaseProperties = false)
{
Argument.IsNotNull("type", type);
var key = GetCacheKey(type, includeModelBaseProperties);
return _catelPropertiesCache.GetFromCacheOrFetch(key, () =>
{
var dictionary = new Dictionary<string, MemberMetadata>();
var propertyDataManager = PropertyDataManager.Default;
var catelTypeInfo = propertyDataManager.GetCatelTypeInfo(type);
var properties = (from property in catelTypeInfo.GetCatelProperties()
select property.Value);
if (!includeModelBaseProperties)
{
properties = properties.Where(x => !x.IsModelBaseProperty);
}
foreach (var property in properties)
{
var memberMetadata = new MemberMetadata(type, property.Type, SerializationMemberGroup.CatelProperty, property.Name)
{
Tag = property
};
var propertyInfo = property.GetPropertyInfo(type);
if (propertyInfo != null && propertyInfo.PropertyInfo != null)
{
var nameOverride = GetNameOverrideForSerialization(propertyInfo.PropertyInfo);
if (!string.IsNullOrWhiteSpace(nameOverride))
{
memberMetadata.MemberNameForSerialization = nameOverride;
}
}
dictionary[property.Name] = memberMetadata;
}
return dictionary;
});
}