This commit is contained in:
grzegorz.russek
2022-02-18 06:24:51 +00:00
parent 51060bcd60
commit 54b4f2de22

View File

@@ -10828,10 +10828,27 @@ namespace DynamORM
{
ParameterExpression param = Expression.Parameter(typeof(InvokeMemberBinder), "o");
try
{
return Expression.Lambda<Func<InvokeMemberBinder, IList<Type>>>(
Expression.TypeAs(
Expression.Field(
Expression.TypeAs(param, binderType), "typeArguments"),
typeof(IList<Type>)), param).Compile();
}
catch
{
}
PropertyInfo prop = binderType.GetProperty("TypeArguments");
if (!prop.CanRead)
return null;
return Expression.Lambda<Func<InvokeMemberBinder, IList<Type>>>(
Expression.TypeAs(
Expression.Field(
Expression.TypeAs(param, binderType), "typeArguments"),
Expression.Property(
Expression.TypeAs(param, binderType), prop.Name),
typeof(IList<Type>)), param).Compile();
}
}
@@ -10888,6 +10905,14 @@ namespace DynamORM
// If this was a success get and return it's value
if (field != null)
return field.GetValue(binder) as IList<Type>;
else
{
PropertyInfo prop = binder.GetType().GetProperty("TypeArguments");
// If we have a property, return it's value
if (prop != null)
return prop.GetValue(binder, null) as IList<Type>;
}
}
else
{