Skip to content

Commit a4f7e9f

Browse files
committed
Allow primitive value type results to be cast to Nullable<T> counterparts.
1 parent 9c9c1d0 commit a4f7e9f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/LinqToExcel/Query/ExcelQueryExecutor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ protected bool ShouldBuildResultObjectMapping<T>(object firstResult, QueryModel
133133
typeof (SumResultOperator)
134134
};
135135

136+
var resultType = firstResult?.GetType();
137+
136138
return (firstResult != null &&
137-
firstResult.GetType() != typeof(T) &&
139+
resultType != typeof(T) &&
140+
resultType != Nullable.GetUnderlyingType(typeof(T)) &&
138141
!queryModel.ResultOperators.Any(x => ignoredResultOperators.Contains(x.GetType())));
139142
}
140143

0 commit comments

Comments
 (0)