Update the static driver sample code to detect Context properties of type IEnumerable<T>.
The UniversalStaticDriver class does not detect the properties of the customType parameter that are directly of type IEnumerable<T>. If the customType inherits IEnumerable<T> (like say via IList<T>) then the property is detected. But if the property is actually declared as IEnumerable<T> then it is passed over.
I changed the line that declared ienumerableOfT from:
let ienumerableOfT = prop.PropertyType.GetInterface ("System.Collections.Generic.IEnumerable`1")
where ienumerableOfT != null
to
let ienumerableOfT = (prop.PropertyType.GetGenericTypeDefinition() == typeof(IEnumerable<>) ? prop.PropertyType : null)
?? prop.PropertyType.GetInterface("System.Collections.Generic.IEnumerable`1")
Kinda hacky, but it fixed the problem for me. Probably a better solution would be to recurse through the type and all inherited types till an IEnumerable<T> is found.
![](https://secure.gravatar.com/avatar/9b93912de129be385bb183b6fd5a77b4?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
Josh Buedel commented
The greater and less thans were stripped from my submission. In the first paragraph all mentions of IEnumerable should be IEnumerable lt T gt. (And IEnumerable with a single type parameter).