1

This may seem like an odd request, however with APIs that require a filter property string I thought it would be a nice concept to be able to convert a provided type safe lambda expression which could then be compiled into a query string - similar in essence to Linq -> SQL.

So for example:

 Func<TQueryObj, bool> 
 (invoice) => { invoice.Status == "DRAFT" && invoice.Type == "ACCREF" };

Would convert to

 Status=="DRAFT" && Type=="ACCREF"

I'm using an invoicing API at the moment hence the example. Any means of achieving this fairly simply?

Cheers

1 Answer 1

4

You need to make an inherited ExpressionVisitor, which will recursively crawl through an Expression<Func<...>>.
It won't be easy.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.