-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: Change JsonQueryExpression.Path to be a List<PathSegment> #28836
Comments
I'm not sure how much we're designing with weakly-typed JSON mapping in mind... But if so, then the above is definitely possible (and important). For example, the PG provider supports the following: _ = ctx.JsonEntities.Single(e => e.CustomerElement.GetProperty("Name").GetString() == "Joe"); ... where GetProperty is an expression-based way to access arbitrary properties (or keys) on JSON elements (it could even be a column expression). We may not allow materializing the result, but at the very least if the query represents a scalar we can read it back or generate a SQL expression that compares it to something, as above. But maybe you have something else in mind for when we implement weakly-typed JSON... |
Weakly-typed JSON doesn't work in EF Core metadata. We cannot translate it and generate metadata for materializing. Bottom-line is weakly-typed JSON, even if we support it cannot use any of the code we have added for now. Let's not ruin the design for the sake of something which will never use the design in first place. |
Up to you, of course. JsonQueryExpression specifically looks like it should be usable for weakly-typed, since it simply expresses traversal... But we can deal with it later, as you wish. |
Well |
In future if we add support for weakly-typed, we could create expression to support weakly-typed and use wrapper over it in place of current expressions we use to add additional metadata. |
Makes sense. |
Where PathSegment can be either
KeyAccess which is string joined using
.
ArrayAccess which is SqlExpression using
[]
Or random string which we would just append, in case provide wants to add more fancier thing.
It cannot be SqlExpression even though SQL syntax allows it because neither user can write a LINQ query which accesses an arbitrary key on an object using column/parameter nor we can translate it because we need metadata of the bound property in order to materialize.
The text was updated successfully, but these errors were encountered: