added hotfix to serialize base classes

This commit is contained in:
Brendan Forster
2014-03-05 21:49:15 +11:00
parent 5a6df4afb4
commit f9f2c816bf
+11 -1
View File
@@ -1773,7 +1773,17 @@ namespace Octokit
public static IEnumerable<PropertyInfo> GetProperties(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().DeclaredProperties;
var typeInfo = type.GetTypeInfo();
var properties = typeInfo.DeclaredProperties;
if (typeInfo.BaseType == null)
return properties;
if (typeInfo.BaseType.FullName == typeof (Object).FullName)
return properties;
var baseProperties = GetProperties(typeInfo.BaseType);
return System.Linq.Enumerable.Concat(properties, baseProperties);
#else
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
#endif