Skip to content
This repository has been archived by the owner on Feb 6, 2021. It is now read-only.

Commit

Permalink
Corrects issue where ColumnDescriptor type may not be exactly equal t…
Browse files Browse the repository at this point in the history
…o PropertyType. Fixes #11
  • Loading branch information
christophano committed Mar 7, 2017
1 parent fbb3e46 commit e6c3b3a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Effort.Extra/ObjectTableDataLoader`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ private Expression ToExpression(ParameterExpression parameter, PropertyInfo prop
{
return Expression.Call(Expression.Constant(table), typeof(ObjectDataTable<T>).GetMethod("GetDiscriminator", BindingFlags.Instance | BindingFlags.NonPublic), parameter);
}
var binder = Binder.GetMember(CSharpBinderFlags.None, column.Name, typeof (ObjectData),
var binder = Binder.GetMember(CSharpBinderFlags.None, column.Name, typeof (ObjectData),
new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) });
var expression = Expression.Dynamic(binder, typeof (object), parameter);
return Expression.TryCatch(expression, Expression.Catch(typeof(RuntimeBinderException), Expression.Constant(null)));
};
};
return Expression.Property(parameter, property);
}

Expand All @@ -75,7 +75,6 @@ private static Expression CastExpression(Expression expression)

private static bool MatchColumnAttribute(PropertyInfo property, ColumnDescription column)
{
if (property.PropertyType != column.Type) return false;
var columnAttribute = property.GetCustomAttribute<ColumnAttribute>();
if (columnAttribute == null) return false;
return columnAttribute.Name == column.Name;
Expand Down

0 comments on commit e6c3b3a

Please sign in to comment.