-
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
Added nullable property to Json mapped model resulting in errors instead of mapping non existing json property to null #30028
Comments
/cc @maumar |
When accessing sub-element within JsonElement in materialization code we use JsonElement.GetProperty. We should use the TryGetProperty instead |
Note from triage: bring to Tactics for patching. |
maumar
added a commit
that referenced
this issue
Jan 20, 2023
…g in errors instead of mapping non existing json property to null Problem was that we when accessing inner property on a JsonElement we used GetProperty. If property is not present (which should be allowed if we try to access optional navigation) KeyNotFound is thrown. Fix is to use TryGetProperty instead to gracefully handle this scenario. Fixes #30028
maumar
added a commit
that referenced
this issue
Feb 24, 2023
…g in errors instead of mapping non existing json property to null Problem was that we when accessing inner property on a JsonElement we used GetProperty. If property is not present (which should be allowed if we try to access optional navigation) KeyNotFound is thrown. Fix is to use TryGetProperty instead to gracefully handle this scenario. Fixes #30028
maumar
added a commit
that referenced
this issue
Feb 24, 2023
…g in errors instead of mapping non existing json property to null (#30101) Problem was that we when accessing inner property on a JsonElement we used GetProperty. If property is not present (which should be allowed if we try to access optional navigation) KeyNotFound is thrown. Fix is to use TryGetProperty instead to gracefully handle this scenario. Fixes #30028
reopening for potential servicing |
maumar
added a commit
that referenced
this issue
Feb 24, 2023
…g in errors instead of mapping non existing json property to null Problem was that we when accessing inner property on a JsonElement we used GetProperty. If property is not present (which should be allowed if we try to access optional navigation) KeyNotFound is thrown. Fix is to use TryGetProperty instead to gracefully handle this scenario. Fixes #30028
when will v7.0.5 be released? |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File a bug
Please see #29219 for context. This issue is precisely described in the comment #29219 (comment) that was added and is related to #29219.
When a new nullable property is added to a model mapped as json, then querying on that should not error, but instead missing json values in the data should just map to null. According to #29219 looks like this was fixed for simple types (string, int, ..) but still does not work for complex types.
Include provider and version information
EF Core version: 7.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 7.0
The text was updated successfully, but these errors were encountered: