-
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
Provide EF.Functions translations for JSON functions #29306
Comments
If this is up for grabs I might look into it @roji |
@joelmandell sure, go ahead - the "good first issue" label is a good indication that it's a relatively accessible issue that external contributors can work on (but always good to check). |
Hi @roji, |
Have you added your method call translator to SqlServerMethodCallTranslatorProvider? |
Yes @roji . I have added it there. But I am missing something else :) |
I can't see anything immediately wrong with that code, what does debugging through it show? Does it maybe get into your method translator but doesn't recognize the method? |
Okay my bad. I did some stupid stuff @roji When I did an EF.Functions.JsonValue with a string property i.e. c.MyStringWithJson, it works. |
Makes sense. We could have the function accept a string parameter - this would prevent this kind of mistake. On the other hand, it's probably fairly common for users to use value converters to convert some user object to a string, and they may wish to call JsonValue over that (and having an object allows that). In theory, it would be nice if users could even invoke this function over an EF7 JSON column property (i.e. an owned entity type); but that likely requires some more significant infrastructure changes to support. In any case, I suggest leaving as-is for now (with object). When you submit your PR, I'll discuss that with the team. |
For users using JSON without a strongly-typed schema, mapping the column as a string is the only option at the moment. We should provide translations for JSON_VALUE/JSON_QUERY for SQL Server and json_extract for SQLite.
The text was updated successfully, but these errors were encountered: