in Darabonba/ModelExtensions.cs [11:35]
public static Dictionary<string, object> ToMap(this Model model)
{
if (model == null)
{
return null;
}
var result = new Dictionary<string, object>();
Type type = model.GetType();
PropertyInfo[] properties = type.GetProperties();
//PropertyInfo
for (int i = 0; i < properties.Length; i++)
{
PropertyInfo propertyInfo = properties[i];
Type property = propertyInfo.PropertyType;
if (typeof(Stream).IsAssignableFrom(property))
{
continue;
}
NameInMapAttribute attribute = propertyInfo.GetCustomAttribute(typeof(NameInMapAttribute)) as NameInMapAttribute;
string realName = attribute == null ? propertyInfo.Name : attribute.Name;
result.Add(realName, ToMapFactory(property, propertyInfo.GetValue(model)));
}
return result;
}