-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add EF.Functions.JsonExists(expression, path) DbFunction #35389
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
base: main
Are you sure you want to change the base?
Conversation
- Define SqlServer translation - Define Sqllite translation Fixes dotnet#31136
8689dd9
to
48692ba
Compare
src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteJsonFunctionsTranslator.cs
Outdated
Show resolved
Hide resolved
- Fix SqlServer translation - Fix Sqllite translation - Add Tests Drafts Fixes dotnet#31136
Sorry for taking to long with no updates, I faced some issues when writing the tests and I did not have the time to check them. I fixed some of the translation code and used object datatype instead of generic which fail early and did not let the method translator to be called. I had issue with SqlServer Compatibility Level, It was configured on the fixtures but the localdb on my device was not the latest version and it took me some time to figure it out. There is some other issues: |
@mseada94 no problem; when you feel the PR is ready for review, flag it as such and we'll take a look. |
@roji I was able to fix all issues, just the owned json property still not sure how to handler it and deal with the property as The owned property serialization and deserialization should be handled by the framework and it supports translating normal expressions so there is no need for using functions such as JsonExists nor JsonValue. Should I ignore this case based on that? |
TODO
EF.Functions.JsonExists
DbFunctiontrue
,false
,null
)Design notes:
EF.Functions.JsonExists
translate toJSON_PATH_EXISTS
function which require SQL Server 2022.EF.Functions.JsonExists
translate to the following expression usingJSON_TYPE
function, as the best available equivalent forJsonExists
at the moment.IIF(arguments_0 IS NULL, NULL, JSON_TYPE(arguments_0, arguments_1) IS NOT NULL)
JSON_TYPE
will returnNULL
which will result inFALSE
to be returned from this expression