-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
feat(Sorting): enable pre sorting in resolver #1253
feat(Sorting): enable pre sorting in resolver #1253
Conversation
I'll check |
@michaelstaib IOrderedQueryable behaves not as one might expect. IQueryable<Foo> t = new Foo []{}.AsQueryable();
t is IOrderedQueryable<Foo>// true
typeof(IOrderedQueryable<Foo>).IsAssignableFrom(t.GetType()) // true The Problem
https://stackoverflow.com/questions/8507746/determine-whether-an-iqueryablet-has-been-ordered-or-not
A solution
|
{ | ||
bool _orderingMethodFound = false; | ||
|
||
public override Expression Visit(Expression node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the reference implementation slightly. This way it stops once a ordermethod is found
var name = node.Method.Name; | ||
|
||
if (node.Method.DeclaringType == typeof(Queryable) && ( | ||
name.StartsWith(nameof(Queryable.OrderBy), StringComparison.Ordinal) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added nameof
instead of magic strings
Queryables can now be pre sorted in the resolver