Skip to content
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

Improved handling target Lambda from Property, Method, Compile() method. #126

Merged
merged 3 commits into from
Oct 21, 2020

Conversation

sdanyliv
Copy link
Contributor

This PR targeted to solve known LINQKit limitations when expression can be expanded only from local variable.
After this fix, these queries are possible.

var query = from q in query.AsExpandable()
   select new 
    {
        ValueViaMethod = SomeMethod().Invoke(q.Id),
        ValueViaMethodWithparameters = SomeMethodWithParameters(someValue).Invoke(q.Id),
        ValueViaProperty = SomeProperty.Invoke(q.Id)

        // alternative way via Compile

        ValueViaMethodCompile = SomeMethod().Compile()(q.Id),
        ValueViaMethodWithparametersCompile = SomeMethodWithParameters(someValue).Compile()(q.Id),
        ValueViaPropertyCompile = SomeProperty.Compile()(q.Id)
    }

@sdanyliv sdanyliv force-pushed the feature/method_expression branch from 96bc608 to 661ac18 Compare October 16, 2020 16:22
Copy link
Collaborator

@StefH StefH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did add some code examples...

src/LinqKit.Core/ExpressionExpander.cs Outdated Show resolved Hide resolved
src/LinqKit.Core/ExpressionExpander.cs Outdated Show resolved Hide resolved
@sdanyliv sdanyliv requested a review from StefH October 19, 2020 11:29
@k1x1987
Copy link

k1x1987 commented Oct 21, 2020

This change is very helpful, I'm impatiently waiting for the merge of that.

Copy link
Collaborator

@StefH StefH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants