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

Is there Way to enter a Complex query #66

Closed
jogibear9988 opened this issue Apr 1, 2017 · 16 comments
Closed

Is there Way to enter a Complex query #66

jogibear9988 opened this issue Apr 1, 2017 · 16 comments

Comments

@jogibear9988
Copy link
Contributor

For example, I've a IEnumerable Object and would like to give this string to dynamic linq:

 "GroupBy(x=>x.Id).OrderBy(x=>x.Key).Select(x=>x.Key).Where(x=>x!=null)"

for Example smth like this

  aaa.Complex("GroupBy(x=>x.Id).OrderBy(x=>x.Key).Select(x=>x.Key).Where(x=>x!=null)")

and it returns a object, so the result could be everything

@StefH
Copy link
Collaborator

StefH commented Apr 1, 2017

@jogibear9988
Copy link
Contributor Author

No. I want everything in one string.

@jogibear9988
Copy link
Contributor Author

@StefH
Copy link
Collaborator

StefH commented Apr 2, 2017

Ah ok. I am not sure on this, if my fork does even support this notation. Did you try this?

@jogibear9988
Copy link
Contributor Author

I'll try... If not, I'll look to patch that this will also work!

@StefH
Copy link
Collaborator

StefH commented Apr 2, 2017

Thanks a lot.

@jogibear9988
Copy link
Contributor Author

Does not work ... :-( Now we need to look what to do...

jogibear9988 added a commit to jogibear9988/System.Linq.Dynamic.Core that referenced this issue Apr 2, 2017
@jogibear9988
Copy link
Contributor Author

One problem: In my commit I removed the

 Type type = _resultType;

Problem here is, we should only do this on the last "new" in the string. How can we decide if this is the case?

@jogibear9988
Copy link
Contributor Author

I've now added it back, but it is a Problem if have have two select new statements, where the first one should be an anonymous type!

@StefH
Copy link
Collaborator

StefH commented Apr 3, 2017

I dont have access to my pc this week. Please investigate some more, I will try to look and merge at sunday. (which branch did you take?)

StefH added a commit that referenced this issue Apr 8, 2017
Work on #66 -> Should work now. Tests will follow on VS2017 support!
@jogibear9988
Copy link
Contributor Author

fixed

@StefH StefH reopened this Apr 30, 2017
@StefH
Copy link
Collaborator

StefH commented Apr 30, 2017

@jogibear9988

Can you create a unit-test which tests all this code?

Expression ParseLambdaOperator()
        {
            Expression expr = ParseOrOperator();
            if (_textParser.CurrentToken.Id == TokenId.Lambda && _it.Type == expr.Type)
            {
                _textParser.NextToken();
                if (_textParser.CurrentToken.Id == TokenId.Identifier ||
                    _textParser.CurrentToken.Id == TokenId.OpenParen)
                {
                    var right = ParseConditionalOperator();
                    return Expression.Lambda(right, new[] { (ParameterExpression)expr });
                }
                _textParser.ValidateToken(TokenId.OpenParen, Res.OpenParenExpected);
            }
            return expr;
        }

I dont understand which test I should write here to cover this code.

@StefH StefH closed this as completed Apr 30, 2017
@StefH StefH reopened this May 4, 2017
@jogibear9988
Copy link
Contributor Author

i'll look

@jogibear9988
Copy link
Contributor Author

I don't know when this part of the code will be hit...

@jogibear9988
Copy link
Contributor Author

We should also check, to support Join Operator: https://dynamiclinq.codeplex.com/discussions/471215

@StefH
Copy link
Collaborator

StefH commented May 16, 2017

  1. Code is never hit I think, I just keep it for now.
  2. Create a new issue for this, and then we can see if this can be implemented.

@StefH StefH closed this as completed May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants