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

Query: Anonymous type to constant comparison should be server eval'ed #14672

Open
smitpatel opened this issue Feb 11, 2019 · 1 comment
Open

Comments

@smitpatel
Copy link
Contributor

return AssertQuery<Customer>(
                isAsync,
                cs => cs.Where(
                    c => new
                    {
                        x = c.City
                    } == new
                    {
                        x = "London"
                    }));

It client evals because the constant is of type anonymous type which TypeMappingSource can never map. We need to be smart about identifying such pattern and deconstruct it. We do similar for joins already (or even for Where), when there are server correlated parameters which causes lack of ConstantExpression.

@roji
Copy link
Member

roji commented May 6, 2022

Note: the above with an anonymous type, but the same applies also the ValueTuple/Tuple. For those, possibly consider row values when dealing with this (#26822, npgsql/efcore.pg#2349) (i.e. the above could be rendered as (x, y) = (3, 4)).

PS Removing duplicate label

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

No branches or pull requests

3 participants