0

My method signature is,

  public async Task<List<TResource>> GetAllAsync(Expression<Func<TResource, bool>> filter = null,
            Func<IQueryable<TResource>, IOrderedQueryable<TResource>> orderBy = null)

I need to pass Orderby column and ascending/decsending information to the webapi. How can I extract the column name and asc/desc information from "orderby""parameter?

Simply, I want to do the reverse process of this post

Community
  • 1
  • 1
Dhanuka777
  • 7,389
  • 5
  • 61
  • 112
  • Just have the method accept the selectors, rather than a function that applies the selectors, if you need to do more than just apply them. You're the one making it hard on yourself needlessly. – Servy Nov 10 '15 at 03:31
  • Hi Servy 2, this method will be exposed via an api client to consumers. So they can use the LINQ expressions to use the method rather than passing strings. One is that it's easier for end user and second thing is it's less errors to consume the API. – Dhanuka777 Nov 10 '15 at 05:53
  • I said nothing about accepting strings. Accept the selector expressions, rather than an entire query. – Servy Nov 10 '15 at 14:00

0 Answers0