Fix bound types not considering interfaces inheriting from other interfaces
This commit is contained in:
parent
613e9dcb09
commit
750d5dab8d
|
@ -36,7 +36,7 @@ namespace Upsilon.BoundTypes
|
||||||
Properties = new Dictionary<string, UserDataBoundProperty>(),
|
Properties = new Dictionary<string, UserDataBoundProperty>(),
|
||||||
Name = name
|
Name = name
|
||||||
};
|
};
|
||||||
var fields = backingType.GetFields().Select(x => new UserDataBoundProperty()
|
var fields = backingType.GetFields(BindingFlags.Public | BindingFlags.Instance).Select(x => new UserDataBoundProperty()
|
||||||
{
|
{
|
||||||
Name = x.Name,
|
Name = x.Name,
|
||||||
ActualType = x.FieldType.Name,
|
ActualType = x.FieldType.Name,
|
||||||
|
@ -46,7 +46,19 @@ namespace Upsilon.BoundTypes
|
||||||
{
|
{
|
||||||
obj.Properties.Add(f.Name.ToLowerInvariant(), f);
|
obj.Properties.Add(f.Name.ToLowerInvariant(), f);
|
||||||
}
|
}
|
||||||
var properties = backingType.GetProperties().Select(x => new UserDataBoundProperty()
|
|
||||||
|
PropertyInfo[] realProperties;
|
||||||
|
if (backingType.IsInterface)
|
||||||
|
{
|
||||||
|
realProperties = new[]{backingType}
|
||||||
|
.Concat(backingType.GetInterfaces())
|
||||||
|
.SelectMany(x => x.GetProperties(BindingFlags.Public | BindingFlags.Instance)).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realProperties = backingType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
}
|
||||||
|
var properties = realProperties.Select(x => new UserDataBoundProperty()
|
||||||
{
|
{
|
||||||
Name = x.Name,
|
Name = x.Name,
|
||||||
ActualType = x.PropertyType.Name,
|
ActualType = x.PropertyType.Name,
|
||||||
|
@ -57,7 +69,7 @@ namespace Upsilon.BoundTypes
|
||||||
obj.Properties.Add(f.Name.ToLowerInvariant(), f);
|
obj.Properties.Add(f.Name.ToLowerInvariant(), f);
|
||||||
}
|
}
|
||||||
var methods = new Dictionary<string, UserDataBoundMethod>();
|
var methods = new Dictionary<string, UserDataBoundMethod>();
|
||||||
var backingMethods = backingType.GetMethods();
|
var backingMethods = backingType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
|
||||||
foreach (var backingMethod in backingMethods)
|
foreach (var backingMethod in backingMethods)
|
||||||
{
|
{
|
||||||
if (backingMethod.IsSpecialName)
|
if (backingMethod.IsSpecialName)
|
||||||
|
|
Loading…
Reference in New Issue