You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried writing unit tests on a specification that will sort entities by status which is a SmartEnum but I get the At least one object must implement IComparable exception.
If this specification is used to sort EF core entities SQL is generated correctly and there is no exception thrown.
Package versions:
Yes, you'll face issues during OrderBy in-memory evaluation for SmartEnum properties.
The expressions for OrderBy are stored as Expression<Func<T, object?>> since there is no easy way to store the original type. And that boxing/casting loses the original's type behavior (in this case, the IComparable interface).
There is no simple workaround here, unfortunately. We'll try to refactor the ordering infrastructure for the next major release.
I tried writing unit tests on a specification that will sort entities by status which is a SmartEnum but I get the
At least one object must implement IComparable
exception.If this specification is used to sort EF core entities SQL is generated correctly and there is no exception thrown.
Package versions:
Code to reproduce:
using the following statement will fix the problem for the in-memory sorting but fails for EF core sorting
The text was updated successfully, but these errors were encountered: