Fixing routing for package changes in reflection

This commit is contained in:
Ryan Nowak 2014-05-05 10:24:29 -07:00
parent f665b131df
commit dfd4ba4b1b
2 changed files with 6 additions and 3 deletions

View File

@ -35,13 +35,16 @@ namespace Microsoft.AspNet.Routing
if (obj != null)
{
var type = obj.GetType();
var allProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
var allProperties = type.GetRuntimeProperties();
// This is done to support 'new' properties that hide a property on a base class
var orderedByDeclaringType = allProperties.OrderBy(p => p.DeclaringType == type ? 0 : 1);
foreach (var property in orderedByDeclaringType)
{
if (property.GetMethod != null && property.GetIndexParameters().Length == 0)
if (property.GetMethod != null &&
property.GetMethod.IsPublic &&
!property.GetMethod.IsStatic &&
property.GetIndexParameters().Length == 0)
{
var value = property.GetValue(obj);
if (ContainsKey(property.Name) && property.DeclaringType != type)

View File

@ -15,7 +15,7 @@
"System.Globalization": "4.0.10.0",
"System.Linq": "4.0.0.0",
"System.Reflection": "4.0.10.0",
"System.Reflection.Compatibility": "4.0.0.0",
"System.Reflection.Extensions": "4.0.0.0",
"System.Resources.ResourceManager": "4.0.0.0",
"System.Runtime": "4.0.20.0",
"System.Runtime.Extensions": "4.0.10.0",