vc-platform icon indicating copy to clipboard operation
vc-platform copied to clipboard

IQueryableExtensions.OrderBy doesn't work for properties of derived types

Open tatarincev opened this issue 6 years ago • 1 comments

Technical details: Currently OrderBySortInfos method cannot sort by properties appeared only in derived types.

Test code example:

//Type registration in factory
AbstractTypeFactory<A>.RegisterType<B>();

class A {};
class B : A
{
public int MyCoolProperty;
public string ToString() {  return MyCoolProperty.ToString(); }
}
var listOfA = new List<A>() { new  B { MyCoolProperty = 10 },  new  B { MyCoolProperty = 5} };
listOfA.AsQueryable().OrderBy("MyCoolProperty").Select(x=> Debug.WriteLine(x.ToString() + " "));
//Invalid (current) output: 10 5
//Valid output: 5 10

Need to fix OrderBySortInfos method and add unit test for this behavior.

tatarincev avatar Feb 04 '19 14:02 tatarincev

@tatarincev Please check, now it works for customers and even sort Contacts properly.

yecli avatar Feb 20 '19 12:02 yecli