-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IComparer<T> not supported for OrderBy? #548
Comments
Hello @NetMage, The ( |
Except that test only works if the string for the field is actually the name of a string field. Try again with an integer field and your passed in IComparer object will be the wrong type. |
Hello @NetMage, Can you check this test: And provide some insights from your side? |
I have the same problem,
The error in visual studio when I run the code
Can you please help me? |
@NetMage Did you have time to look at my new / updated UnitTests ? @maxime-ducoroy Maybe it's related to Postgress database? Did you try SQL ? Or can you provide a full working example project? |
OrderBy accepts a IComparer but it have to implement both public class CustomComparer : IComparer<object>, IComparer
{
public int Compare(object x, object y)
{
// Compare here
}
} |
@i-am-jyotirmaya I've changed the code so that you can also provide an var orderByDynamic = qry.OrderBy("Income", new ObjectComparer()).ToArray(); |
How can the
OrderBy
overloads that take anIComparer
actually be used, since the calls generated expect the types passed to the comparer match the types of the dynamic fields created by the string expression?Is there any way to have an
IComparer<object>
be used?The text was updated successfully, but these errors were encountered: