Generic OrderBy broken in version 9.6.540
Posted: Wed 27 Jun 2018 18:47
Hi,
in my project I've implemented sorting like:
var parameter = Expression.Parameter(typeof(TEntity), "e");
var property = Expression.Property(parameter, sortData.PropertyName);
var converted = Expression.Convert(property, typeof(object));
var expression = Expression.Lambda<Func<TEntity, dynamic>>(converted, parameter);
if (sortData.SortType == SortType.Ascending)
sortedResults = queryable.OrderBy(expression);
(...)
It's most common way to implement sorting Entity by given string propertyName.
It was working in version 9.5.520, now materializing results is throwing exceptions like:
System.InvalidOperationException: No mapping to a relational type can be found for the CLR type 'object'.
when property is string or
System.IndexOutOfRangeException: Index was outside the bounds of the array.
when property is long. There is no type that is working now.
Version of dotConnect you have released is now blocking us from migration to EF Core 2.1.
in my project I've implemented sorting like:
var parameter = Expression.Parameter(typeof(TEntity), "e");
var property = Expression.Property(parameter, sortData.PropertyName);
var converted = Expression.Convert(property, typeof(object));
var expression = Expression.Lambda<Func<TEntity, dynamic>>(converted, parameter);
if (sortData.SortType == SortType.Ascending)
sortedResults = queryable.OrderBy(expression);
(...)
It's most common way to implement sorting Entity by given string propertyName.
It was working in version 9.5.520, now materializing results is throwing exceptions like:
System.InvalidOperationException: No mapping to a relational type can be found for the CLR type 'object'.
when property is string or
System.IndexOutOfRangeException: Index was outside the bounds of the array.
when property is long. There is no type that is working now.
Version of dotConnect you have released is now blocking us from migration to EF Core 2.1.