diff --git a/Upsilon/BoundTypes/UserDataBoundTypeDefinition.cs b/Upsilon/BoundTypes/UserDataBoundTypeDefinition.cs index f445a43..826bb2c 100644 --- a/Upsilon/BoundTypes/UserDataBoundTypeDefinition.cs +++ b/Upsilon/BoundTypes/UserDataBoundTypeDefinition.cs @@ -36,7 +36,7 @@ namespace Upsilon.BoundTypes Properties = new Dictionary(), 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, ActualType = x.FieldType.Name, @@ -46,7 +46,19 @@ namespace Upsilon.BoundTypes { 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, ActualType = x.PropertyType.Name, @@ -57,7 +69,7 @@ namespace Upsilon.BoundTypes obj.Properties.Add(f.Name.ToLowerInvariant(), f); } var methods = new Dictionary(); - var backingMethods = backingType.GetMethods(); + var backingMethods = backingType.GetMethods(BindingFlags.Public | BindingFlags.Instance); foreach (var backingMethod in backingMethods) { if (backingMethod.IsSpecialName)