vc-platform
vc-platform copied to clipboard
IQueryableExtensions.OrderBy doesn't work for properties of derived types
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 Please check, now it works for customers and even sort Contacts properly.